Click to See Complete Forum and Search --> : htaccess - redirect .php to .html


mameha1977
02-07-2007, 08:36 PM
I am currently changing my site so that it uses X/Z/.html links instead of .php?id=Xid2=Z

I have got the htaccess working to load static X/Z/.html links correctly.

I am now updating all my links to point to X/Z/.html instead of .php, BUT I find that the links will only work if the URI is currently .html. If the URI contains .php then the links wont work.

So I want to direct all .php requests to the .html URI automatically. Is there a way to do this in htaccess? Or does it make an infinite loop? I just get the 'internal server error' message all the time.

LeeU
02-08-2007, 09:48 AM
There are some instructions here (http://httpd.apache.org/docs/2.2/misc/rewriteguide.html) for going from .html to .php. It's under the heading "Backward Compatibility for YYYY to XXXX migration." (Or just see the article here. (http://www.precedence.co.uk/support/internet/index.php/rewriteext)) I have used it and it works great. You, however, are going the opposite way, so this should give you a start, with a few changes (I haven't had time to check it, though).