Forum Moderators: phranque

Message Too Old, No Replies

mod rewrite + .htaccess Problem

getting infinite loop on my website...

         

Fl1p

10:33 pm on Nov 20, 2007 (gmt 0)

10+ Year Member



I currently have this on my .htaccess file

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*)\.html$ /index.php?page=$1

So that will produce www.domain.com/url.html

Now I want to add this...


RewriteRule ^buy/([^\/]+)$ /index.php?page=buy&catname=$1
RewriteRule ^buy/([^\/]+)/$ /index.php?page=buy&catname=$1

So that will produce www.domain.com/buy/something

BUT when I combine everything in one .htaccess file I'm getting an infinite loop on my website...

Any idea how to fix this? Any help will be greatly appreciated.

Thanks

jdMorgan

10:40 pm on Nov 20, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I see no reason that this would produce a loop without some other code doing a rewrite or a redirect, however, it can be optimized a bit for speed and efficiency:

Options +FollowSymLinks
RewriteEngine on
#
RewriteRule ^([^.]+)\.html$ /index.php?page=$1 [L]
#
RewriteRule ^buy/([^/]+)/?$ /index.php?page=buy&catname=$1 [L]

Jim

Fl1p

2:46 am on Nov 21, 2007 (gmt 0)

10+ Year Member



Hey,

Your code actually fixed my problem. I think the (.*)\.html$ part was the problem.

Thanks for the help!