Reputation: 427
I would like to write a rule, that would redirect URL like this:
myweb.com/en/page
to
myweb.com/page.php?lang=en
This code:
RewriteRule ^/(cz|en)/(.*)$ $2?lang=$1 [L]
does not work (error 404). Thanks everyone.
Upvotes: 0
Views: 243
Reputation: 41229
You dont need to match the leading slash in RewriteRule's pattern on htaccess context :
RewriteRule ^(cz|en)/(.*)$ $2?lang=$1 [L]
Upvotes: 0
Reputation: 2195
Try this following:
RewriteRule ^/(cz|en)/(.*)$ $2.php?lang=$1 [L]
Upvotes: 1