R
R
Ruslan2021-11-18 13:26:10
htaccess
Ruslan, 2021-11-18 13:26:10

Why doesn't RewriteRule work in .htaccess?

Hello!
RewriteRule for controllers are written in this way:

RewriteEngine On
    RewriteBase /

 RewriteRule ^([a-z]+)/([a-z]+)/([0-9]+).html$ /?controller=$1&action=$2&id=$3&%{QUERY_STRING} [NS,L]
 RewriteRule ^([a-z]+)/([a-z]+).html$ /?controller=$1&action=$2&%{QUERY_STRING} [NS,L]
 RewriteRule ^([a-z]+).html$ /?controller=$1&%{QUERY_STRING} [NS,L]

But if you type site.ru/?controller=about , then it will go to this address too. Although, in theory, it should redirect to site.ru/about.html
How to fix it?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question