Forum Moderators: phranque

Message Too Old, No Replies

internal redirect problem

         

danielkun

7:45 pm on Oct 15, 2012 (gmt 0)

10+ Year Member



Hi,

I've been trying to get the following to work without success.
Is there anyone that can help me?

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)

RewriteRule ^diary([^.]+).html$ /index.php?page=diary&paging=$1 [L]
RewriteRule ^(.+)\.html$ /index.php?page=$1 [L]
RewriteRule ^(.+)$ /index.php/$1 [L]


What I want to do is:

1. Check for "diary{number}.html" patterns
2. Check for any patters referring to an .html file.
3. If the above are not found (use slash separated values)

However, I get the following error and I can't figure out why:


[Mon Oct 15 21:38:42 2012] [error] [client 127.0.0.1] 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.


Commenting out the last row will make it work. Leaving the last row uncommented causes an error 500.

Thank you.

g1smd

8:33 pm on Oct 15, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Your RewriteCond applies only to the next RewriteRule.

Without its own RewriteCond the last RewriteRule will loop as index.php will rematch the (.+) pattern.

Add a blank line after each RewriteRule so the code is more clear.

danielkun

9:07 pm on Oct 15, 2012 (gmt 0)

10+ Year Member



Thank you very much!