N
N
Nixtone2017-09-14 16:41:07
Regular Expressions
Nixtone, 2017-09-14 16:41:07

Why does the redirect not work in a block?

DirectoryIndex index.php
AddDefaultCharset UTF-8

Options -Indexes
Options FollowSymLinks

php_flag magic_quotes_gpc off
php_flag register_globals off

# Добавление слеша в конце пути
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} /+[^\.]+$
RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ /content.php?PATH=/$1 [L,QSA]
  
</IfModule>

Why doesn't the "# Add a slash at the end of the path" block work inside "IfModule mod_rewrite.c" ? I take it out for the block, everything works right there.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2017-09-15
@shambler81

DirectoryIndex index.php
AddDefaultCharset UTF-8
Options -Indexes
Options FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /content.php?PATH=/$1 [L, QSA]
php_flag magic_quotes_gpc off
php_flag register_globals off
# Add trailing slash
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} /+[^\.]+$
RewriteRule ^(.+[ ^/])$ %{REQUEST_URI}/ [R=301,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question