.htaccess - RewriteCond blank domain to the domain with the correct path -


how set redirects following conditions:

url http://domainname.be becomes http://www.domainname.be/nl/

url http://www.domainname.be becomes http://www.domainname.be/nl/

url http://domainname.be/nl/custompage/ becomes http://www.domainname.be/nl/custompage/

?

rewrite conditions

rewritecond %{http_host} ^domainname.be [nc] redirectrule ^(.*)$ http://www.domainname.be$1 [r=301,l]  rewritecond %{http_host} ^domainname.be [nc] rewritecond %{request_uri} ^/$ redirectrule ^(.*)$ http://www.domainname.be/nl$1 [r=301,l]  rewritecond %{http_host} ^www.domainname.be [nc] rewritecond %{request_uri} ^/$ redirectrule ^(.*)$ http://www.domainname.be/nl$1 [r=301,l]  rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^/nl/custompage /custompage.aspx?lang=nl [l,nc]  rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^/nl/custompage/ /custompage.aspx?lang=nl [l,nc] 

but doesn't work. also, need clear browsercache in order have latest conditions?

remove of existing rules , use this:

rewritecond %{http_host} ^(www\.)?domainname\.be$ [nc] redirectrule ^((?!nl/).*)$ http://www.domainname.be/nl/$1 [r=301,l] 

and yes test out in different browser avoid 301 caching issues.


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -