i need to change some htm files in my webserver to .php files. These pages are linked from various places. i dont want them to show a file not found error when someone tries to access them.
For example if the index.htm needs to be changed to index.php can i write a redirect
redirect 301 /index.html index.php
in my htaccess file? Is this the best approach?
Thanks
Prady
This won’t work if you are sending data via POST. Anything other than renaming the files and rewriting the links is an ugly and temporary hack. FWIW, you can avoid this by having each ‘page’ in its own directory and referencing the dir in the URL and specifying the default file via the directoryIndex config.
You didn’t mention what OS this is running on – if its Linux/Unix/BSD then you could just use sed to change all the absolute links (and grep to find the relative ones which you’ll probably need to edit by hand).
Something like….