Answer the question
In order to leave comments, you need to log in
How to make CNC with PHP?
Good afternoon!
I set up the CNC in the project, everything works, I read a lot of manuals for setting up .htaccess, I tried different options, but only one thing does not work!
when using /test-test2-test3 - everything works fine
, and when using /test/test2/test3 - it starts looking for the /test/ directory and starts further from it.
.htaccess code:
AddDefaultCharset off
IndexOptions +Charset=UTF-8
DirectoryIndex index.php
RewriteEngine On
Options +FollowSymlinks
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*) index.php?%{QUERY_STRING}
Answer the question
In order to leave comments, you need to log in
This is strange, the code is correct, it works for me.
From myself, I can recommend all the same instead
of using the construction of the formRewriteRule ^(.*)$ index.php?q=$1 [QSA,L]
I doubt it, but try after
Add line ending character $
Thus:
#...
RewriteRule ^(.*)$ index.php?%{QUERY_STRING}
#...
Try to implement
CNC like this in PHP. Stay away from ModeRewrite rules. A single one ...
or write everything manually
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z-]+)/test/([0-9]+)(/?)$ ?category=$1&page=$2
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php?r=$1
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question