Forum Moderators: phranque
This is what I have come up with. Is this the correct approach?
RedirectMatch 301 (.*)\.htm$ [mysite.com...]
RedirectMatch 301 [b]^/([^.]+)[/b]\.htm$ http://www.mysite.com/this-directory/$1.php
So, you could use mod_rewrite, and just point the old html URLs to php like this:
RewriteRule ^/([^.]+)\.html$ /this_directory/$1.php [L]
(I assume the code is located in the subdirectory itself; If not, then add that path to the beginning of the pattern.)
Jim
So, you could use mod_rewrite, and just point the old html URLs to php like this:RewriteRule ^/([^.]+)\.html$ /this_directory/$1.php [L]
the result of which would be that the old URLs could still be used, and would simply call up the php files of the same name, with no-one the wiser.
Yes, this is actually what I wanted to do. Sometimes my thinking get a little .. um .. "off track".:)
(I assume the code is located in the subdirectory itself; If not, then add that path to the beginning of the pattern.)
Yes, I'm going through my largest site one directory at a time and in this one I needed to add some dynamic features to each page.
Thanks for your continuing help, Jim.
dave
maybe I made a mistake. Here is what I did.
I made up an .htaccess file and uploaded to [mysite.com...]
That directory is where all the new *.php files are located
This is what I put in the .htaccess
[quote]RewriteEngine on
RewriteRule ^/([^.]+)\.html$ /this directory/$1.php [L][quote]
I tried it with and without the "RewriteEngine on" line
Tried ith with .htm$ and .html$
Tried it in the public_html .htaccess as well
I have a file called "thisfile.php" so I just changed the address in the browser from:
[mysite.com...]
to
[mysite.com...]
I get a 404
Tried several other files in that directory .. all 404