Reputation: 1599
What I am trying to do is to redirect the user who use for example en.domain.com/blog
to domain.com/blog
I have three languages en/es/fr
I tried something like this For the english but its not working.
RewriteCond %{HTTP_HOST} ^en\.domain\.com\/blog
RewriteRule ^(.*)$ /blog/$1 [L]
Anyhelp Thanks
Upvotes: 1
Views: 32
Reputation: 34003
Put this into your document root folder:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^en\.domain\.com$
RewriteRule ^blog(.*)$ /blog$1 [R,L]
The HTTP_HOST does not contain any URI (path part). Also you have to switch the "rewrite engine" on.
Upvotes: 1
Reputation: 19016
Put this code in your htaccess (which has to be in root folder)
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(en|es|fr)\.domain\.com$ [NC]
RewriteCond %{REQUEST_URI} ^/blog [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
Upvotes: 2