C
C
Carlyndow Marlifi2022-03-15 21:31:36
htaccess
Carlyndow Marlifi, 2022-03-15 21:31:36

Why does the .htaccess plug work strangely?

RewriteRule ^info/?$ /index.php?page=info [L,QSA]
There is such a line in the plug. In theory, it should translate to the site at
site.ru/info
This is how it works. But, if you add a slash to the end, for example
site.ru/info/ or site.ru/info////,
then the page you need still opens, although it seems like it should not

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2022-03-15
@petushok55

The rule is triggered for info//// because the RewriteRule input gets a string after all duplicates have been removed, /i.e. always just info/. If you remove it
from the template, then the rule will work only for site.ru/info If you need a 301 redirect from /info//// -> /info/^info/?$/?

RewriteCond %{THE_REQUEST} ^[^?]+//
RewriteRule .* /$0 [R=301,L]

Prepend .htaccess right after RewriteEngine on.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question