.htaccess - 301 redirect both www and non-www to fake directory -


i want site redirect default language if 1 not requested user — i.e. if default language english, want redirect user http://domain.com/english/ when he/she enters http://domain.com/.

at same time, want remove 'www' part url, redirect traffic through http://domain.com/index.php.

i have following .htaccess file, working great when user enters www.domain.com, not when user enters domain.com (without 'www'). doing wrong?

# # remove www url #  rewriteengine on rewritecond %{http_host} ^(www\.)example.com$ [nc] rewriterule ^(.*)$ http://example.com/english/$1 [r=301,l]  # # redirect traffic through index.php #  rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php?$1 [l,qsa] 

try this:

# remove www url , redirect /english/ rewriteengine on rewritecond %{http_host} ^www\.example\.com$ [or] rewritecond %{request_uri} ^/$ rewriterule ^(.*)$ http://example.com/english/$1 [r=301,l] 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -