P
P
Peter Zubkov2015-08-12 01:34:12
Apache HTTP Server
Peter Zubkov, 2015-08-12 01:34:12

Redirect from www + CNC?

There is a site with a customized CNC. When added to the url www, the CNC flies rainbow. That is: site.ru/article/statia-o-putinewww.site.ru/article.php?slug=statia-o-putine
.htaccess

RewriteEngine On
RewriteBase /

# ЧПУ
RewriteRule ^article/([^/]*)$ /article.php?id=$1 [L]
RewriteRule ^category/([^/]*)$ /articles.php?genre=$1 [L]
RewriteRule ^search/([^/]*)$ /search.php?q=$1 [L]

# Без слеша в конце
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]

I tried to add a redirect to without www after the second line :
Options +FollowSymLinks
RewriteCond %{HTTP_HOST}	^www\.(.*)	[NC]
RewriteRule ^(.*)$ http://%1/$1	[R=301,L]

As a result, this successfully redirects to without www, but the CNC also crashes: site.ru/article/statia-o-putinesite.ru/article.php?slug=statia-o-putine

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
heartdevil, 2015-08-12
@heartdevil

Hello.
It seems that the CNC crashes, because your checks for articles, category, search are higher, and when the replacement for them is triggered, then further checking and processing is cut off due to [L].
Try checking for www to put above the state of emergency and remove the parameter L

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question