Reputation: 73
I have a rather strange .htaccess question. I am building a multi lingual website and need to virtually hide a page.php?lang=en page ending.
I know that I can change www.domain.com/page.php?lang=eng
to www.domain.com/page/eng
but is it possible to show the domain as www.domain.com/eng/page
.
Any .htaccess guides would also be greatly appreciated
Upvotes: 3
Views: 69
Reputation: 143896
For this: www.domain.com/eng/page
, you'd need to put something like this in the htaccess file in your document root:
RewriteEngine On
RewriteCond %{THE_REQUEST} \ /+page\.php\?lang=([a-z]+)
RewriteRule ^ /%1/page? [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z]+)/page$ /page.php?lang=$1 [L]
Upvotes: 2