Reputation: 1308
I would like to redirect all URLs ending in
data.html
to templates/data.php
info.html
to templates/info.php
any_other_file.html
to templates/index.php
Again, all URLs ending with those names (could be http://some-domain.com/some/long/path/data.html
)
Upvotes: 0
Views: 2496
Reputation: 9007
You can use this in your /.htaccess
file:
RewriteEngine On
# Internally rewrite data/info.html to the applicable PHP file
# in the templates directory
RewriteRule (data|info).html$ /templates/$1.php [NC,L]
# Rewrite everything else ending in .html to /templates/index.php
RewriteRule ^(.*).html$ /templates/index.php [NC,L]
Upvotes: 2