Answer the question
In order to leave comments, you need to log in
Problem with mod rewrite in .htaccess, already changed URL comes to the address bar, how to fix it?
Hello everyone, I wrote some rules for changing the URL in .htaccess
# Turn on URL rewriting
RewriteEngine On
# Installation directory
RewriteBase /
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} ! -d
# Rewrite all other URLs to index.php/URL
RewriteRule ^([a-zA-Z]+)\/([0-9]{1,2})\/?$ /index.php?c= $1&page=$2 [R=301,L]
RewriteRule ^([0-9]{1,2})\/?$ /index.php?page=$2 [R=301,L]
RewriteRule ^([a- zA-Z]+)\/?$ /index.php?c=$1 [R=301,L]
everything works, but in the address bar instead of site/home/1 comes /index.php?c= already changed according to the rule home&page=1
tell me pliz che thread) I use Denver.
Answer the question
In order to leave comments, you need to log in
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteBase / delete
these lines
And do this:
RewriteRule ^([a-zA-Z]+)\/([0-9]{1,2})\/?$ /index.php?c=$1&page=$2 [QSA]
RewriteRule ^([0-9]{1,2})\/?$ /index.php?page=$2 [QSA]
RewriteRule ^([a-zA-Z]+)\/?$ /index.php?c=$1 [QSA]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question