Hello, buddies . Question 1: As the title above How can I rewrite .php pages to .htm pages. How can I rewrite .php pages to .html pages. (Other requirement:after rewriting, visitors can't visit original php pages or 404 error if visitors try to visit the original php page.) Question 2: If there is following code in index.php <?php require_once('foot.php' ); ?> After rewrite, do I have to change the code to <?php require_once('foot.html' ); ?> I am a newbie in .htaccess rules . Thanks for your help.
You can rename all your .php to .html and/or .htm then add the appropriate handler to .htaccess, on our servers the following works: AddType application/x-httpd-php5 .htm .html Code (markup): Just ask your host for the information. If you rename .php to .html then yes you need to update the requires and includes. My advice just try a test before swapping the whole site.
I think using .htaccess can solve the problem . It doesn't get involved with the host setting . How to write the .htaccess rules ?
hi try this in .htaccess RewriteEngine On RewriteBase / RewriteRule ^([^\/]+)\.html$ /$1.php It will work Regards Alex
You need to add another rule to 404 the PHP files which is why I think it's going to be easier to just treat .html as PHP