E
E
Evgeny Khakhalkin2017-04-28 16:15:31
Apache HTTP Server
Evgeny Khakhalkin, 2017-04-28 16:15:31

Why does a redirect from pages with a slash at the end to pages without a slash work everywhere except the main one?

The problem in general is this: I set up a redirect on the site from pages with a slash at the end to pages without a slash at the end.
The redirect works everywhere except the main page. Why so - I do not understand. The engine is self-written. Website: rentalservice.pro
htaccess:

AddDefaultCharset UTF8

RewriteEngine On

RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

RewriteCond %{REQUEST_URI} !\?
RewriteCond %{REQUEST_URI} !\&
RewriteCond %{REQUEST_URI} !\=
RewriteCond %{REQUEST_URI} !\.
RewriteCond %{REQUEST_URI} ![^\/]$
RewriteRule ^(.*)\/$ /$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . cms.php [L]
DirectoryIndex cms.php

Redirect 301 /index /

Redirect 301 /prokat/scenicheskie-konstrukcii/  /prokat/scenicheskie-konstrykcii/


RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{HTTP_REFERER} !^http://rentalservice.pro/cp/.*$
RewriteCond %{REQUEST_URI} ^/uploads/(?!processed|raw).+$
RewriteRule ^uploads/(.+)$ /watermark?image=$1 [P,NC]

php_flag display_errors off
php_value date.timezone "Europe/Moscow"
php_value upload_max_filesize 30M
php_value post_max_size 30M

The problem, it seems to me, is rather non-trivial. Has anyone come across something similar?
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Khakhalkin, 2017-04-28
@djonslaterye

Maybe someone will come in handy
I solved the problem myself by adding:

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

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question