Forum Moderators: phranque
There are four directories as follows:-
mydomain.com/directory1
mydomain.com/directory1/directory2
mydomain.com/directory1/directory3
mydomain.com/directory1/directory4
Each of these directories contain approx 250 files with .html extension. I need to edit these pages and add some functionality which means that I need to change the extension to .php
Creating the new pages is not a problem. What Im getting stuck with is how to ensure that if anyone visits the site
eg mydomain.com/directory1/page17.html they automatically get forwarded to mydomain.com/directory1/page17.php
NB This needs to be set up to make both users and SE bots happy :-)
I am presuming I need to edit the .htaccess but the only way I know how is to add a separate line for every file (ie about 1000 lines).
Is there anyway to cut this down to a few lines.
Please remember that not ALL .html pages on the website need to be forwarded to .php only those in these four particular directories.
Any assistance would be gratefully accepted.
However, just because you want to parse a file for PHP code doesn't mean you have to change the filename or the URL; You can always tell Apache to parse .html files for PHP code, either globally in example.com/.htaccess, or in separate .htaccess files in those directories only. See Apache mod_mime, AddHandler directive.
Jim