Answer the question
In order to leave comments, you need to log in
How to setup .htaccess redirect with CNC?
Hello.
Do not tell me, there is a line like:
RewriteRule ^([a-zA-Z0-9_-]+)/?([a-zA-Z0-9_-]*)/?([0-9]*)/?( [a-zA-Z0-9:;_-]*)/?$ /index.php?action=$1¶m=$2&page_num=$3&option=$4
But when accessing www, the address becomes:
https://site. ru//index.php/product-name/?action=ca...
When accessing the site, everything is fine:
https://site.ru/catalog/product-name/
Can you help solve the problem? Thank you.
The file itself:
RewriteEngine on
RewriteCond %{HTTPS} on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L]
RewriteCond %{HTTP_HOST} ^www.site.ru$ [NC]
RewriteRule ^(.*)$ https://site.ru/$1 [R=301,L]
RewriteRule ^([a-zA-Z0-9_-]+)/?([a-zA-Z0-9_-]*)/?([0-9]*)/?([a-zA-Z0-9:;_-]*)/?$ /index.php?action=$1¶m=$2&page_num=$3&option=$4
Answer the question
In order to leave comments, you need to log in
Firstly, this line seems to contain an error:
Must be (with an exclamation mark), otherwise I don't understand the meaning of this redirect - it should be a check for an http connection (lack of https in the URL).
In addition, check how it will work if you replace these linesRewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^www.site.ru$ [NC]
RewriteRule ^(.*)$ https://site.ru/$1 [R=301,L]
on theRewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,R=301]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question