httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Josh Trutwin <>
Subject [users@httpd] avoiding a redirect loop with rewrites
Date Thu, 22 Feb 2007 18:20:51 GMT

I'm working for a small company that uses a custom CMS.  When
customers create pages in the CMS a file gets created based on the
page's id number - for example:

I've pushed some code into the CMS that lets the site admin create a
nice URL for each page so you get something nicer like:

The pid5.html file still exists but now they should see the new URL
everywhere on the site.  The rule I used for this was:

RewriteRule ^products.html$ /pages/pid5.html [L,QSA,NC]

One of the folks in charge here wanted to make sure that for
existing sites anyone who still had the old URL bookmarked or search
engines that have the old URL gets a permanent redirect to the new
one to avoid having two URLs that go to the same place.  I thought
I'd do this with a RedirectPermanent, but when I do that I get a
redirect loop.  I also tried creating rewrite rules for the pid5.html
page - no luck.

Basically, is there any way to have a rewrite rule map a new URL name
to an existing page, and also a permanent redirect for anyone using
the old URL name.  I would have to think this has come up before but
wasn't able to find anything.

Thanks for your help,


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