A
A
Alexander Ivanov2022-02-20 20:31:01
Apache HTTP Server
Alexander Ivanov, 2022-02-20 20:31:01

Why is RewriteRule not working?

There is a link https://site.ru/network , as planned, I expect a redirect (which will not be visible in the address bar) to the address https://site.ru/index.php?action=network . But for some reason this does not happen, instead the server gives an error "Not Found". What is wrong with my .htaccess file?

RewriteEngine On  
RewriteBase / 
Options +FollowSymlinks 
AddDefaultCharset UTF-8

RewriteRule ^(.*)$ index.php?action=$1 [QSA]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2022-02-20
@alexivanov77

Handling of .htaccess files is disabled and content is simply ignored.
You can enable it by adding it AllowOverride Allin the VirtualHost settings.

RewriteRule ^(.*)$ /index.php?action=$1 [QSA]

In this form, there will be a loop and a 500 error. You
can eliminate the cyclic redirect like this:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php?action=$1 [QSA,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question