С поиска нашел несколько тем и добавил в .htaccess код
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/ RewriteRule ^index\.php$ http://%1/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/ RewriteRule ^index\.php$ http://%1/$1 [R=301,L]
<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTPS} !=on RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] RewriteRule ^ %{ENV:PROTO}://%1%{REQUEST_URI} [R=301,L] </IfModule>
Помогите пожалуйста с редиректом с www.site.ru на site.ru для instantcms 2.3
# Rewrite www RewriteCond %{HTTP_HOST} ^www.site.ru$ RewriteRule (.*) http://site.ru/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.site\.com$ [NC] RewriteRule ^(.*)$ http://site.com/$1 [R=301,L]
# InstantCMS rewriting rules # Initialization AddDefaultCharset utf-8 Options -Indexes RewriteEngine on RewriteBase / # Hide text files RewriteRule ^.htaccess$ - [F] RewriteRule ^credits.txt$ - [F] RewriteRule ^readme.txt$ - [F] RewriteRule ^license.(.*).txt$ - [F] # Remove trailing slash from URLs RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)/$ /$1 [R=301,L] # Sitemaps RewriteRule ^sitemap(.*).xml$ /cache/static/sitemaps/sitemap$1.xml [L] # Engine routing RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php [L] RewriteCond %{HTTP_HOST} ^www.my-instantcms.ru RewriteRule ^(.*)$ http://my-instantcms.ru/$1 [R=permanent,L] # RewriteCond %{THE_REQUEST} ^(GET|HEAD)\ /index.php RewriteRule ^index\.php$ http://my-instantcms.ru/ [R=301,L]
можете показать весь код файла .htaccess
# Initialization AddDefaultCharset utf-8 Options -Indexes RewriteEngine on RewriteBase / # Rewrite www RewriteCond %{HTTP_HOST} ^www.lovelovely.ru$ RewriteRule (.*) http://lovelovely.ru/$1 [R=301,L] # Hide text files RewriteRule ^.htaccess$ - [F] RewriteRule ^credits.txt$ - [F] RewriteRule ^readme.txt$ - [F] RewriteRule ^license.(.*).txt$ - [F] # Remove trailing slash from URLs RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)/$ /$1 [R=301,L] # Sitemaps RewriteRule ^sitemap(.*).xml$ /cache/static/sitemaps/sitemap$1.xml [L] # Engine routing RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php [L]