Re: [PHP] Apache: Request exceeded the limit of 10 internal redirects
Marek Kilimajer wrote: ... I know its due to the way my Apache is setup (not rewrite rules) but the following always works for me: http://www.somedomain.com/doit runs http://www.somedomain.com/doit.php -- apache just does its magic - I believe its to do with the DocumentIndex apache conf setting (i.e. Apache makes use of the extensions found there) - please someone correct me if I'm wrong. heh Marek, I wasn't the original poster on this thread - I don't have any problems with my setup - I was just mentioning the behaviour of my server which does make use of some rewrite rules - but (AFAIKS) not for the behaviour I described. Your conditions are as follows: 1. reqeusted filename is not a directory: RewriteCond %{REQUEST_FILENAME} !-d 2. reqeusted filename is not a file: RewriteCond %{REQUEST_FILENAME} !-f If all above matches, put ".php" at the end: RewriteRule ^(.*)$ /$1.php So it has nothing to do with DocumentIndex. All that is necessary is to request a file that does not exist on the server even if you add ".php" at the end: /foo - neither file or directory, rewrite to /foo.php /foo.php - neither file or directory, rewrite to /foo.php.php /foo.php.php - neither file or directory, rewrite to /foo.php.php.php ...etc. The problem is ^(.*)$ matches everything. Try ^([^.]*)$ - no dot in url as I said I don't have a problem but your point is well made is relation to the originally posted problem :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache: Request exceeded the limit of 10 internal redirects
Jochem Maas wrote: Richard Lynch wrote: James Guarriman wrote: RewriteEngine on RewriteOptions MaxRedirects=15 RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ /$1.php ... I know its due to the way my Apache is setup (not rewrite rules) but the following always works for me: http://www.somedomain.com/doit runs http://www.somedomain.com/doit.php -- apache just does its magic - I believe its to do with the DocumentIndex apache conf setting (i.e. Apache makes use of the extensions found there) - please someone correct me if I'm wrong. Your conditions are as follows: 1. reqeusted filename is not a directory: RewriteCond %{REQUEST_FILENAME} !-d 2. reqeusted filename is not a file: RewriteCond %{REQUEST_FILENAME} !-f If all above matches, put ".php" at the end: RewriteRule ^(.*)$ /$1.php So it has nothing to do with DocumentIndex. All that is necessary is to request a file that does not exist on the server even if you add ".php" at the end: /foo - neither file or directory, rewrite to /foo.php /foo.php - neither file or directory, rewrite to /foo.php.php /foo.php.php - neither file or directory, rewrite to /foo.php.php.php ...etc. The problem is ^(.*)$ matches everything. Try ^([^.]*)$ - no dot in url -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache: Request exceeded the limit of 10 internal redirects
Richard Lynch wrote: James Guarriman wrote: RewriteEngine on RewriteOptions MaxRedirects=15 RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ /$1.php ... I know its due to the way my Apache is setup (not rewrite rules) but the following always works for me: http://www.somedomain.com/doit runs http://www.somedomain.com/doit.php -- apache just does its magic - I believe its to do with the DocumentIndex apache conf setting (i.e. Apache makes use of the extensions found there) - please someone correct me if I'm wrong. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache: Request exceeded the limit of 10 internal redirects
Richard Lynch wrote: RewriteRule ^(.*)$ /$1.php You probably wanted more like: RewriteRule ([^\.]) /$1.php That probably ain't right, but your goal is to get only filenames with NO '.' in them, and you need \ to esacpe the . so it doesn't mean "any character" Dot has no special meaning in a character class (that's inside []). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache: Request exceeded the limit of 10 internal redirects
James Guarriman wrote: > RewriteEngine on > RewriteOptions MaxRedirects=15 > RewriteCond %{REQUEST_FILENAME} !-d > RewriteCond %{REQUEST_FILENAME} !-f > RewriteRule ^(.*)$ /$1.php > > Despite the very very very scary warnings not to, turn on the Rewrite Logging feature and tail -f the log until you figure this out. Otherwise, you will be banging your head against a black box, with NO IDEA why it does what it does (other than hurt). :-) Just remember to turn it OFF when you are on a Production site, or you'll regret it quickly. What you probably want is to only match things that don't already have a '.' in them -- If they ask for foo.jpg, and it's not there, you don't want foo.jpg.php instead, right? That's what you tried to do with this: > RewriteRule ^(.*)$ /$1.php You probably wanted more like: RewriteRule ([^\.]) /$1.php That probably ain't right, but your goal is to get only filenames with NO '.' in them, and you need \ to esacpe the . so it doesn't mean "any character" -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache: Request exceeded the limit of 10 internal redirects
James Guarriman wrote: Hi I've just installed Apache 2.0.52, with: ./configure --prefix=/usr/local/httpd --enable-so --enable-modules=all My httpd.conf includes: --- ServerAdmin [EMAIL PROTECTED] DocumentRoot "/home/mydomain" ServerName mydomain ErrorLog logs/mydomain-error_log CustomLog logs/mydomain-access_log common DirectoryIndex index.php index.html index.html.var php_flag allow_url_fopen 1 php_flag magic_quotes_gpc 0 RewriteEngine on RewriteOptions MaxRedirects=15 RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ /$1.php The above condition matches favicon.ico because it's neither directory or file, so it's rewritten to favicon.ico.php, that again matches the above condition...etc. So you need to come up with regexp that does not match if the file extension is .php - (I try to make Apache serve 'foo' as 'foo.php') -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache: Request exceeded the limit of 10 internal redirects
James Guarriman wrote: Hi I've just installed Apache 2.0.52, with: ./configure --prefix=/usr/local/httpd --enable-so --enable-modules=all My httpd.conf includes: --- ServerAdmin [EMAIL PROTECTED] DocumentRoot "/home/mydomain" ServerName mydomain ErrorLog logs/mydomain-error_log CustomLog logs/mydomain-access_log common DirectoryIndex index.php index.html index.html.var php_flag allow_url_fopen 1 php_flag magic_quotes_gpc 0 RewriteEngine on RewriteOptions MaxRedirects=15 RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ /$1.php - (I try to make Apache serve 'foo' as 'foo.php') But when accessing 'http://mydomain/foo', I get no webpage, but this error log: -- [Mon Jan 24 10:47:59 2005] [debug] mod_rewrite.c(1778): [client 192.168.2.101] mod_rewrite's internal redirect status: 10/15. [Mon Jan 24 10:47:59 2005] [error] [client 192.168.2.101] 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. [Mon Jan 24 10:47:59 2005] [debug] core.c(2748): [client 192.168.2.101] r->uri = /favicon.ico.php.php.php.php.php.php.php.php.php.php [Mon Jan 24 10:47:59 2005] [debug] core.c(2754): [client 192.168.2.101] redirected from r->uri = /favicon.ico.php.php.php.php.php.php.php.php.php [Mon Jan 24 10:47:59 2005] [debug] core.c(2754): [client 192.168.2.101] redirected from r->uri = /favicon.ico.php.php.php.php.php.php.php.php [Mon Jan 24 10:47:59 2005] [debug] core.c(2754): [client 192.168.2.101] redirected from r->uri = /favicon.ico.php.php.php.php.php.php.php If I remove the line 'RewriteOptions MaxRedirects=15', I get a very similar error: [Wed Jan 24 10:31:29 2005] [debug] mod_rewrite.c(1778): [client 192.168.2.101] mod_rewrite's internal redirect status: 10/10. [Wed Jan 24 10:31:29 2005] [error] [client 192.168.2.101] mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary. [Wed Jan 24 10:31:29 2005] [debug] mod_rewrite.c(1778): [client 192.168.2.101] mod_rewrite's internal redirect status: 0/10. --- What am I doing wrong? Thank you very much. What you are doing wrong is trying to use mod_rewrite, the nightmare extension from hell! Seriously though, it is your rewrite rule that is wrong, you have defined a recursion in there for any filename that do not already end '.php' or have no . RewriteRule ^(.*)$ /$1.php => add '.php' to the end of any filename that has a '.' in it somewhere (remember that you are in unix world, so the . does not signify a file extension in the same way as a domestos environment, it is just part of the filename). eg1) blah => blah (no change as it doesn't match the regex) eg2) favicon.ico => favicon.ico.php when the rule next runs, it finds that favicon.ico.php does not match the exception of .php (the .ico gives the first match), so adds .php again, and again, and again, and again. Tom __ Do you Yahoo!? Yahoo! Mail - 250MB free storage. Do more. Manage less. http://info.mail.yahoo.com/mail_250 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Apache: Request exceeded the limit of 10 internal redirects
Hi I've just installed Apache 2.0.52, with: ./configure --prefix=/usr/local/httpd --enable-so --enable-modules=all My httpd.conf includes: --- ServerAdmin [EMAIL PROTECTED] DocumentRoot "/home/mydomain" ServerName mydomain ErrorLog logs/mydomain-error_log CustomLog logs/mydomain-access_log common DirectoryIndex index.php index.html index.html.var php_flag allow_url_fopen 1 php_flag magic_quotes_gpc 0 RewriteEngine on RewriteOptions MaxRedirects=15 RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ /$1.php - (I try to make Apache serve 'foo' as 'foo.php') But when accessing 'http://mydomain/foo', I get no webpage, but this error log: -- [Mon Jan 24 10:47:59 2005] [debug] mod_rewrite.c(1778): [client 192.168.2.101] mod_rewrite's internal redirect status: 10/15. [Mon Jan 24 10:47:59 2005] [error] [client 192.168.2.101] 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. [Mon Jan 24 10:47:59 2005] [debug] core.c(2748): [client 192.168.2.101] r->uri = /favicon.ico.php.php.php.php.php.php.php.php.php.php [Mon Jan 24 10:47:59 2005] [debug] core.c(2754): [client 192.168.2.101] redirected from r->uri = /favicon.ico.php.php.php.php.php.php.php.php.php [Mon Jan 24 10:47:59 2005] [debug] core.c(2754): [client 192.168.2.101] redirected from r->uri = /favicon.ico.php.php.php.php.php.php.php.php [Mon Jan 24 10:47:59 2005] [debug] core.c(2754): [client 192.168.2.101] redirected from r->uri = /favicon.ico.php.php.php.php.php.php.php If I remove the line 'RewriteOptions MaxRedirects=15', I get a very similar error: [Wed Jan 24 10:31:29 2005] [debug] mod_rewrite.c(1778): [client 192.168.2.101] mod_rewrite's internal redirect status: 10/10. [Wed Jan 24 10:31:29 2005] [error] [client 192.168.2.101] mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary. [Wed Jan 24 10:31:29 2005] [debug] mod_rewrite.c(1778): [client 192.168.2.101] mod_rewrite's internal redirect status: 0/10. --- What am I doing wrong? Thank you very much. __ Do you Yahoo!? Yahoo! Mail - 250MB free storage. Do more. Manage less. http://info.mail.yahoo.com/mail_250 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php