Reputation: 353
i would like to rewrite all my website's urls from this https://website.com/page.php?lang=2 to this https://website.com/en/page
(creating /en/ directory while hiding .php extension)
Can anyone help me with this one? Thank you in advance
Upvotes: 1
Views: 549
Reputation: 7476
Try it like this,
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^en/([\w-]+)$ $1.php?lang=2 [QSA,L]
Upvotes: 2