K
K
kamisarlapsha2018-07-10 16:10:40
Apache HTTP Server
kamisarlapsha, 2018-07-10 16:10:40

Why redirect error?

Hi, I redirected from .php to without and removed the / at the end. When you enter an address, say site.com/xxx.php, it redirects to site.com/xxx. Just what you need, only an error appears that such a file was not found. Although there is a xxx.php file in the root directory.
Here is the error itself: The requested URL /xxx was not found on this server.

RewriteEngine On
RewriteCond %{REQUEST_URI} ^(.+)/$
RewriteRule .* http://%{HTTP_HOST}%1 [R=301,L,QSA]
RewriteCond %{REQUEST_URI} ^(.+)\.php$
RewriteRule ^(.+)\.php$ /$1 [R=301,L]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2018-07-10
@shambler81

I have examples of both here.
https://klondike-studio.ru/standards/standartnyy-h...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question