IPB

Welcome Guest ( Log In | Register )

 
Ответить в данную темуНачать новую тему
> .htaccess Редиректы, Redirecting www to non-www
Гость_Василий_*
post 2.6.2010, 17:47
Post #1





Guests






Цитата
If you want to redirect all non-www requests to your site to the www version, all you need to do is add the following code to your .htaccess file:
in your .htaccess file

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ url://www.%{HTTP_HOST}/$1 [R=301,L]


RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
RewriteRule ^.*$ url://domain.com%{REQUEST_URI} [R=301,L]

Redirecting www to non-www

If you want to do the opposite, the code is very similar:
in your .htaccess file

RewriteEngine On
RewriteCond %{HTTP_HOST} !^my-domain\.com$ [NC]
RewriteRule ^(.*)$ url://my-domain.com/$1 [R=301,L]
Перейти в начало страницы
 
+Цитировать сообщение

Ответить в данную темуНачать новую тему

 



Lo-Fi Version Time is now: 21.5.2018, 12:10