Как избавиться от "/index.php"

Автор Tazit, 09-10-2016, 11:34:17

« назад - далее »

TazitTopic starter

Цитата: Krokodilchik от 09-10-2016, 17:17:17RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://site.ru/ [R=301,L]

Сделал.
Теперь из меню не включается главная страница, все остальные так и работают с "/index.php".

  •  


Clever

Попробуйте такой вариант для исключения index.php, index.html, index.htm:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.(php|html|htm)\ HTTP/
RewriteRule ^(.*)$ http://%{HTTP_HOST} [R=301,L]


mihadmitriev

# If the requested path and file is not /index.php and the request
# has not already been internally rewritten to the index.php script
RewriteCond %{REQUEST_URI} !^/index\.php
# and the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path and file doesn't directly match a physical folder
RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.php script
RewriteRule .* index.php [L]
  •