I
I
iamerror2016-11-26 17:06:23
Search Engine Optimization
iamerror, 2016-11-26 17:06:23

How to redirect from www to non-www?

I made a redirect with this code in the htaccess file: RewriteEngine On RewriteCond %{HTTP_HOST} ^www.example.ru$ [NC] RewriteRule ^(.*)$ example.ru/$1 [R=301,L]
BUT!
Now if I go to any page from wwww, then I will be redirected to example.ru/index.php and throws 404.
How can I make it so that when I go to any page from www, I am thrown to a similar one without www.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan, 2016-11-28
@IvanDanko

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
Make sure httpd. conf has the mod_rewrite module enabled and the FollowSymLinks option enabled.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question