Htaccess - перенаправление запросов на файл

Материал из Wiki - Iphoster - the best ever hosting and support. 2005 - 2023
Перейти к:навигация, поиск
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Самые выгодные сервера‎


htaccess - перенаправление запросов на файл

Пример:

перенаправление запросов вида:
http://site.in.ua/controll
http://site.in.ua/controll/log
на файл controll.php?target=$1

Добавляем в .htaccess:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
#RewriteRule ^(.*)$ index.php
RewriteRule ^(controll.*)$ controll.php?target=$1 [L]



Links: