Reputation: 177
I've a problem in url rewriting. i want to rewrite my url that is currently displaying as
domain.com/index.php?lang=fr
and i want to show it like
fr.domain.com
any help will be appereciated. Thanks
Upvotes: 1
Views: 569
Reputation: 785316
Try this code on DOCUMENT_ROOT/.htaccess
on domain.com
:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteCond %{QUERY_STRING} (?:^|&)lang=([^&]+) [NC]
RewriteRule ^ http://%1.%{HTTP_HOST}%{REQUEST_URI}? [NE,R=301,L]
Upvotes: 1