A
A
Andrew2014-02-26 13:07:05
htaccess
Andrew, 2014-02-26 13:07:05

Why do two conditions conflict in .htaccess?

good afternoon.
Why do these 2 conditions conflict with each other?

# вторая часть (делает редирект для  *.php)
RewriteCond %{REQUEST_URI} ^(.*)\.php$
RewriteRule ^(.*)\.php$ $1\/ [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]

In theory, if I went to site.ru/page/, the first condition should not work. What's wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2014-02-26
@Laptinius

everything is solved :)
I just did it like this in the last line:
RewriteRule ^(.*)(\/)$ %{REQUEST_FILENAME}.php/ [L]
Everything seems to work as it should

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question