Forum Moderators: phranque
I have been using the rewriterule for years now to make all my links within my site nice and search engine friendly.
However it was not until today that I heard about redirecting the old urls to the nice new furls.
If I have a url:
http://www.example.com/product/123
It loads the page http://www.example.com/product.php?id=123 which is fine.
If the user types in http://www.example.com/product.php?id=123 I think the correct thing to do is redirect them to http://www.example.com/product/123 right?
If this is the case do I use rewritecond to deal with the vars and then redirectmatch?
Thanks in advance,
Dave
You surmise correctly that you should externally redirect the old 'dynamic' URLs to their new static equivalents.
There's a trick to it though, because the commonly-attempted "simple" solution leads to an "infinite" rewrite/redirect loop. The solution is to use a RewrietCond testing THE_REQUEST, REDIRECT_STATUS, or an ENV: variable that you have previously defined, so that only *direct client requests* for the dynamic URL are redirected (and not internal requests resulting from previously executing your friendly-URL-to-script rewriterule).
Jim