Answer the question
In order to leave comments, you need to log in
Why doesn't it remove *.php?
Here is my code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# всё что не касается файлов и не имеет точки в названии, добавлять в конце слеш
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)\.(.*){1,5}$
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*[^/])$ $1/ [L,R=301]
# делает редирект для *.php)
RewriteCond %{REQUEST_URI} ^(.*)\.php$
RewriteRule ^(.*)\.php$ $1\/ [L,R=301]
# убираем индексы
RewriteCond %{REQUEST_URI} ^(.*)index.php(.*)$
RewriteRule ^(.*)index.php(.*)$ $1$2 [L,R=301]
# site.ru/*/ открывает как site.ru/*.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)(\/)$ %{REQUEST_FILENAME}.php/ [L]
</IfModule>
Answer the question
In order to leave comments, you need to log in
See what you get
in some htaccess tester, for
example : htaccess.madewithlove.be would not be quite right.
At least fix the line:
RewriteRule ^(.*)\.php$ $1\/ [L,R=301]
$1\/ replace with $1/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question