Answer the question
In order to leave comments, you need to log in
How to convert links from GET to CNC?
Hello. There is a simple CNC through .htaccess.
Yes, I know that CNC needs to be done through PHP, i.e. in .htaccess redirect to the entry file (index.php) and parse the url there (something like this). But so far it has been done.
The actual code is below:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?page=$1 [L,QSA]
</IfModule>
RewriteCond %{QUERY_STRING} ^/index.php?page=(.*)$
RewriteRule ^/index.php?page=(.*)$ /$1 [L,R=301]
Answer the question
In order to leave comments, you need to log in
The dot is a special character.
The question mark is a special character.
In regular seasons, they need to be screened.
Your expression matches a string like /indexfphpage=123 or /indexsphppage=123 (i.e. after index there is 1 any character except for a line break (\n), in php the last p is optional (because of ?))
Correct regular expression - ^/index\.php\?page=(.*)$
But I don't understand the meaning of such a redirect =\
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question