kiowa_jackson Posted December 21, 2007 Share Posted December 21, 2007 I'm switching a .html site to php. I know you can use mod rewrite to change .html urls to .php...does anyone know the exact code you need to use? It's for a fairly high traffic site so I want to make sure I get it right... thanks Quote Link to comment https://forums.phpfreaks.com/topic/82697-using-mod-rewrite-to-move-your-site-to-php/ Share on other sites More sharing options...
wildteen88 Posted December 21, 2007 Share Posted December 21, 2007 mod rewrite is nothing to do with PHP. If your .html files contain PHP code then your PHP code wont be parsed, unless your server is configured to parse .html files as PHP. If your server is not configured to parse .html files as PHP then you'll have to configure your server to do so, if you don't want to convert your .html files to .php files. What you might be able to do is add the following line to a .htaccess file within your websites root: AddType application/x-httpd-php .html If your host allows you to change the servers configuration via .htaccess then you should find your .html files are now being parsed by PHP. You can test this by creating a simple test html file with the following code: <?php phpinfo(); ?> When you run test.html you may find that you'll get a full of page of info about PHP's configuration/environment. If you don't then you'll need to convert your .html files to .php instead. Quote Link to comment https://forums.phpfreaks.com/topic/82697-using-mod-rewrite-to-move-your-site-to-php/#findComment-420622 Share on other sites More sharing options...
kiowa_jackson Posted December 21, 2007 Author Share Posted December 21, 2007 Thanks for the reply. Actually, I'm changing all my pages to .php extension. However there are many links pointing to various pages with .html extension. What I want to do is simply make sure that anyone who clicks on a link pointing to /page.html gets redirected to /page.php Quote Link to comment https://forums.phpfreaks.com/topic/82697-using-mod-rewrite-to-move-your-site-to-php/#findComment-420674 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.