httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sander Marechal <>
Subject Re: [users@httpd] 301 redirect looping with mod_rewrite
Date Thu, 17 May 2007 16:28:07 GMT
Joshua Slive wrote:
> On 5/17/07, Sander Marechal <> wrote:
>> (1) RewriteCond %{query_string} t=([a-z]+)
>> (2) RewriteRule ^index.php$ /page/%1/? [r=301,l]
>> The next rule makes sure that the pretty URLs all end in a slash. It
>> also does a 301 redirect causing the browser to send a new request.
>> (3) RewriteRule ^page/([^/]+)$ /page/$1/ [r=301,l]
>> Here I parse the new pretty URL to get the old URL back for processing.
>> (4) RewriteRule ^page/([^/]+)/$ /index.php?t=$1
> Are you forced to use .htaccess for this? If not, you should put this
> stuff in the main server context of httpd.conf. It makes things much
> easier, and also gives you access to the RewriteLog, which is the only
> reasonable way to debug mod_rewrite problems.

Unfortunately, yes. This website sits on a regular shared webhost so I
don't have access to mod_rewrite. I do have a test server where I have
full access though.

> Your problem is that the results of (4) are getting reinjected to
> mod_rewrite for processing, and will then obviously match (1) and (2).

I figured as much, but can you tell me why it's reinjected? That's the
part I really don't understand.

> Since I don't use mod_rewrite in .htaccess, I can't tell you exactly
> how to fix this, but here are a few ideas:

Thanks for those. I'll try them out and let you know :-)

Sander Marechal

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message