У меня есть простой .htaccess, который по какой-то причине не может правильно перенаправить:
RewriteEngine on
RewriteBase /
RewriteRule ^.*$ /test.php [L]
Есть запись в журнале:
[Tue Nov 16 17:04:12 2010] [error] [client 213.141.155.85] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Tue Nov 16 17:04:12 2010] [debug] core.c(3053): [client 213.141.155.85] r->uri = /test.php
[Tue Nov 16 17:04:12 2010] [debug] core.c(3059): [client 213.141.155.85] redirected from r->uri = /test.php
[Tue Nov 16 17:04:12 2010] [debug] core.c(3059): [client 213.141.155.85] redirected from r->uri = /test.php
[Tue Nov 16 17:04:12 2010] [debug] core.c(3059): [client 213.141.155.85] redirected from r->uri = /test.php
[Tue Nov 16 17:04:12 2010] [debug] core.c(3059): [client 213.141.155.85] redirected from r->uri = /test.php
[Tue Nov 16 17:04:12 2010] [debug] core.c(3059): [client 213.141.155.85] redirected from r->uri = /test.php
[Tue Nov 16 17:04:12 2010] [debug] core.c(3059): [client 213.141.155.85] redirected from r->uri = /test.php
[Tue Nov 16 17:04:12 2010] [debug] core.c(3059): [client 213.141.155.85] redirected from r->uri = /test.php
[Tue Nov 16 17:04:12 2010] [debug] core.c(3059): [client 213.141.155.85] redirected from r->uri = /test.php
[Tue Nov 16 17:04:12 2010] [debug] core.c(3059): [client 213.141.155.85] redirected from r->uri = /test.php
[Tue Nov 16 17:04:12 2010] [debug] core.c(3059): [client 213.141.155.85] redirected from r->uri = /blabla
URL-адрес, к которому я пытаюсь получить доступ: / blabla
Вроде переписал правильно, но опция [L] как-то не действует. Как это может быть?
виртуальный хост настроен так:
<VirtualHost *:80>
ServerName www.mx-key.ru
ServerAlias mx-key.ru www.mx-key.ru
ServerAdmin FractalizeR@yandex.ru
DocumentRoot /home/mxkey/mx-key.ru/www
DirectoryIndex index.html index.htm index.php index.php5 index.php4 index.php3 index.shtml
ErrorLog /home/mxkey/mx-key.ru/logs/httpd_error.log
CustomLog /home/mxkey/mx-key.ru/logs/httpd_access.log "%v %h %l %u %t \"%r\" %>s %b"
LogLevel Debug
<IfModule mod_fastcgi.c>
Options +ExecCGI
FastCgiExternalServer /home/mxkey/mx-key.ru/www/php-fpm.handler -socket /home/mxkey/php-fpm.sock -idle-timeout 600
AddType application/x-httpd-fastphp5 .php
Action application/x-httpd-fastphp5 /php-fpm.handler
</IfModule>
</VirtualHost>
Вам необходимо указать RewriteCond
также - твой RewriteRule
всегда соответствует всему (из-за ^.*$
). Взгляните сюда:
Вам нужно исключить цель RewriteRule
, который /test.php
.
Примерно так должно работать:
RewriteCond %{REQUEST_URI} !^/test.php$
который говорит что-то вроде «перезаписывайте, только если URI запроса не начинается с /test.php».