Answer the question
In order to leave comments, you need to log in
htaccess and closing slashes?
Greetings venerable habrasobshchestvo!
I turn to the universal mind to resolve the problem that has baffled me.
So, the task: through .htaccess, you need to glue pages with a slash ("/") and without it at the end of the address, while the main mirror will be pages without.
It would seem that everything is simple:
RewriteRule ^(.*)/$ $1 [L,QSA]
But for some reason QSA does not work, i.e. the final page does not receive anything in the POST ... What am I doing wrong?
If anything, here is the full text of all transformations:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ % {HTTP_HOST}/$1 [R=301,L, QSA]
RewriteCond %{REQUEST_URI} ^(.*)/$ [NC]
RewriteRule ^(.*)/$ $1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L,QSA]
(first, make it the main mirror “without www”, secondly, remove the trailing slash, and finally transfer all non-existent files to /index.php)
Answer the question
In order to leave comments, you need to log in
yes, as said above, it's best not to rewrite everything that contains post requests
RewriteCond %{REQUEST_METHOD} !POST
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question