.htaccess - Only rewrite when domain only -
i want write domain domian requested , not rewrite when there subdirectories.
so when accessing
example.com
you sent
example.com/fr
but when go
example.com/albums
you taken
example.com/albums
not
example.com/fr/albums
which happening
rewritecond %{http_host} ^www.example.fr [nc] rewriterule ^(.*)$ http://www.example.fr/fr/$1 [l,r=301,nc]
that because you're capturing uri in rewriterule (.*)
, appending end in substitution $1
. need match on domain , remove both of those.
try this.
rewritecond %{http_host} ^(www\.)?example\.com [nc] rewriterule ^$ http://www.example.com/fr [l,r=301,nc]
Comments
Post a Comment