Forum Moderators: phranque
I'd like to do something like this:
User goes to /pageA.php
Htaccess looks to see if /old/pageA.html exists
if it does, then go to /old/pageA.html else
go to /pageA.php
I'd like to know if there is a way to strip the extension off of the REQUEST_URI. So, in other words, if you go to /pageA.php, be able to use just 'pageA'.
Hopefully that makes sense.
Thanks!
# If URL-path not already rewritten to /old/<requested_path>
RewriteCond %{REQUEST_URI} !^/old/
# and if <document_root>/old/<requested_path> exists as a file
RewriteCond %{DOCUMENT_ROOT}/old%{REQUEST_URI} -f
# then rewrite to /old/<requested_path>
RewriteRule ^(pageA\.php)$ /old/$1 [L]
For more information, see the documents cited in our forum charter [webmasterworld.com].
Jim