You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Vladislav Rastrusny <Fr...@yandex.ru> on 2010/04/26 21:29:36 UTC

[users@httpd] Problem: .htaccess mod_rewrite RewriteRule line causes HTTP Error 500 messages instead of 404 ones

Hello.

I have a server with VBulletin forum (working under Apache 2.2,
CentOS). The default settings for it in .htaccess are as follows:

    RewriteEngine on

    RewriteCond %{HTTP_HOST} ^gsmforum\.ru
    RewriteRule (.*) http://www.gsmforum.ru/$1 [R=301,L]

    # If you are having problems or are using VirtualDocumentRoot,
uncomment this line and set it to your vBulletin directory.
    RewriteBase /

    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d

    RewriteRule ^.*$ - [NC,L]

    # Forum
    RewriteRule ^threads/.* showthread.php [QSA]
    RewriteRule ^forums/.* forumdisplay.php [QSA]
    RewriteRule ^members/.* member.php [QSA]
    RewriteRule ^blogs/.* blog.php [QSA]
    ReWriteRule ^entries/.* entry.php [QSA]

    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d

    RewriteRule ^.*$ - [NC,L]

    # MVC
    RewriteRule ^(?:(.*?)(?:/|$))(.*|$)$ $1.php?r=$2 [QSA]

If I try to access any non-existent URL on forum like
www.example.com/ajdsjaskasajs, server throws HTTP 500 error.

Apache log says:

    [Sun Apr 25 17:24:32 2010] [error] [client 82.211.152.12] 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., referer:
http://www.gsmforum.ru/forumdisplay.php?424-%CD%EE%E2%EE%F1%F2%E8-%EF%F0%EE%E3%F0%E0%EC%EC%E0%F2%EE%F0%EE%E2

If I switch LogLevel to Debug I get something like this:

    [Sun Apr 25 17:30:46 2010] [debug] core.c(3059): [client
95.25.70.85] redirected from r->uri =
/robots.txt.php.php.php.php.php.php.php.php.php
    [Sun Apr 25 17:30:46 2010] [debug] core.c(3059): [client
95.25.70.85] redirected from r->uri =
/robots.txt.php.php.php.php.php.php.php.php
    [Sun Apr 25 17:30:46 2010] [debug] core.c(3059): [client
95.25.70.85] redirected from r->uri =
/robots.txt.php.php.php.php.php.php.php
    [Sun Apr 25 17:30:46 2010] [debug] core.c(3059): [client
95.25.70.85] redirected from r->uri =
/robots.txt.php.php.php.php.php.php
    [Sun Apr 25 17:30:46 2010] [debug] core.c(3059): [client
95.25.70.85] redirected from r->uri = /robots.txt.php.php.php.php.php
    [Sun Apr 25 17:30:46 2010] [debug] core.c(3059): [client
95.25.70.85] redirected from r->uri = /robots.txt.php.php.php.php
    [Sun Apr 25 17:30:46 2010] [debug] core.c(3059): [client
95.25.70.85] redirected from r->uri = /robots.txt.php.php.php
    [Sun Apr 25 17:30:46 2010] [debug] core.c(3059): [client
95.25.70.85] redirected from r->uri = /robots.txt.php.php
    [Sun Apr 25 17:30:46 2010] [debug] core.c(3059): [client
95.25.70.85] redirected from r->uri = /robots.txt.php
    [Sun Apr 25 17:30:46 2010] [debug] core.c(3059): [client
95.25.70.85] redirected from r->uri = /robots.txt
    [root@server2 logs]# tail httpd_error.log
    [Sun Apr 25 17:31:27 2010] [debug] core.c(3059): [client
217.118.79.27] redirected from r->uri =
/clientscript.php.php.php.php.php.php.php, referer:
http://74.125.77.132/search?q=cache:bGPJ8XkSvlMJ:www.gsmforum.ru/showthread.php%3Ft%3D62479+%D0%A3%D0%BC%D0%B5%D0%BD%D1%8C%D1%88%D0%B5%D0%BD%D0%B8%D0%B5+%D0%BF%D0%B8%D0%BD%D0%B3%D0%B0+3G+%D0%BC%D0%BE%D0%B4%D0%B5%D0%BC&cd=3&hl=ru&ct=clnk&gl=ru
    [Sun Apr 25 17:31:27 2010] [debug] core.c(3059): [client
217.118.79.27] redirected from r->uri =
/clientscript.php.php.php.php.php.php, referer:
http://74.125.77.132/search?q=cache:bGPJ8XkSvlMJ:www.gsmforum.ru/showthread.php%3Ft%3D62479+%D0%A3%D0%BC%D0%B5%D0%BD%D1%8C%D1%88%D0%B5%D0%BD%D0%B8%D0%B5+%D0%BF%D0%B8%D0%BD%D0%B3%D0%B0+3G+%D0%BC%D0%BE%D0%B4%D0%B5%D0%BC&cd=3&hl=ru&ct=clnk&gl=ru
    [Sun Apr 25 17:31:27 2010] [debug] core.c(3059): [client
217.118.79.27] redirected from r->uri =
/clientscript.php.php.php.php.php, referer:
http://74.125.77.132/search?q=cache:bGPJ8XkSvlMJ:www.gsmforum.ru/showthread.php%3Ft%3D62479+%D0%A3%D0%BC%D0%B5%D0%BD%D1%8C%D1%88%D0%B5%D0%BD%D0%B8%D0%B5+%D0%BF%D0%B8%D0%BD%D0%B3%D0%B0+3G+%D0%BC%D0%BE%D0%B4%D0%B5%D0%BC&cd=3&hl=ru&ct=clnk&gl=ru
    [Sun Apr 25 17:31:27 2010] [debug] core.c(3059): [client
217.118.79.27] redirected from r->uri = /clientscript.php.php.php.php,
referer: http://74.125.77.132/search?q=cache:bGPJ8XkSvlMJ:www.gsmforum.ru/showthread.php%3Ft%3D62479+%D0%A3%D0%BC%D0%B5%D0%BD%D1%8C%D1%88%D0%B5%D0%BD%D0%B8%D0%B5+%D0%BF%D0%B8%D0%BD%D0%B3%D0%B0+3G+%D0%BC%D0%BE%D0%B4%D0%B5%D0%BC&cd=3&hl=ru&ct=clnk&gl=ru
    [Sun Apr 25 17:31:27 2010] [debug] core.c(3059): [client
217.118.79.27] redirected from r->uri = /clientscript.php.php.php,
referer: http://74.125.77.132/search?q=cache:bGPJ8XkSvlMJ:www.gsmforum.ru/showthread.php%3Ft%3D62479+%D0%A3%D0%BC%D0%B5%D0%BD%D1%8C%D1%88%D0%B5%D0%BD%D0%B8%D0%B5+%D0%BF%D0%B8%D0%BD%D0%B3%D0%B0+3G+%D0%BC%D0%BE%D0%B4%D0%B5%D0%BC&cd=3&hl=ru&ct=clnk&gl=ru
    [Sun Apr 25 17:31:27 2010] [debug] core.c(3059): [client
217.118.79.27] redirected from r->uri = /clientscript.php.php,
referer: http://74.125.77.132/search?q=cache:bGPJ8XkSvlMJ:www.gsmforum.ru/showthread.php%3Ft%3D62479+%D0%A3%D0%BC%D0%B5%D0%BD%D1%8C%D1%88%D0%B5%D0%BD%D0%B8%D0%B5+%D0%BF%D0%B8%D0%BD%D0%B3%D0%B0+3G+%D0%BC%D0%BE%D0%B4%D0%B5%D0%BC&cd=3&hl=ru&ct=clnk&gl=ru
    [Sun Apr 25 17:31:27 2010] [debug] core.c(3059): [client
217.118.79.27] redirected from r->uri = /clientscript.php, referer:
http://74.125.77.132/search?q=cache:bGPJ8XkSvlMJ:www.gsmforum.ru/showthread.php%3Ft%3D62479+%D0%A3%D0%BC%D0%B5%D0%BD%D1%8C%D1%88%D0%B5%D0%BD%D0%B8%D0%B5+%D0%BF%D0%B8%D0%BD%D0%B3%D0%B0+3G+%D0%BC%D0%BE%D0%B4%D0%B5%D0%BC&cd=3&hl=ru&ct=clnk&gl=ru
    [Sun Apr 25 17:31:27 2010] [debug] core.c(3059): [client
217.118.79.27] redirected from r->uri =
/clientscript/vbulletin_css/style-d95b06dc-00001.css, referer:
http://74.125.77.132/search?q=cache:bGPJ8XkSvlMJ:www.gsmforum.ru/showthread.php%3Ft%3D62479+%D0%A3%D0%BC%D0%B5%D0%BD%D1%8C%D1%88%D0%B5%D0%BD%D0%B8%D0%B5+%D0%BF%D0%B8%D0%BD%D0%B3%D0%B0+3G+%D0%BC%D0%BE%D0%B4%D0%B5%D0%BC&cd=3&hl=ru&ct=clnk&gl=ru

If I remove or comment the last (#MVC) line from .htaccess all is
fine. The problem seem to be in this last line. But VBulletin support
says, this line is ok and my problem is just a server issue. Is that
so? If this is a server issue, then, how to correct it? I am using
default httpd from CentOS 5.4 base repos.

And BTW, why does the last line cause infinite recursion?

----------------------------------
Best regards,
Vladislav "FractalizeR" Rastrusny
http://www.fractalizer.ru
FractalizeR@yandex.ru

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org