$Three3 Posted February 11, 2010 Share Posted February 11, 2010 Hi, I am tryng to configure my server to parse HTML files as php. I just don't know where to put the .htaccess file on my server. I don't have root access on my server since I am on a shared hosting plan with GoDaddy. Any help in the right direction would be great. Thanks a lot in advance for the help. So would I just create an .htaccess file and add this one line? AddType application/x-httpd-php .html Quote Link to comment https://forums.phpfreaks.com/topic/191791-htaccess-file-help/ Share on other sites More sharing options...
yozyk Posted February 11, 2010 Share Posted February 11, 2010 RemoveHandler .html .htm AddType application/x-httpd-php .php .htm .html .phtml Quote Link to comment https://forums.phpfreaks.com/topic/191791-htaccess-file-help/#findComment-1010855 Share on other sites More sharing options...
$Three3 Posted February 11, 2010 Author Share Posted February 11, 2010 RemoveHandler .html .htm AddType application/x-httpd-php .php .htm .html .phtml ok awesome. And would I just put that in the directory where I upload my files tithe server? And does that work for the whole server or just the directory that it is in? Also, do I have to restart my server? Thanks again Quote Link to comment https://forums.phpfreaks.com/topic/191791-htaccess-file-help/#findComment-1010865 Share on other sites More sharing options...
yozyk Posted February 12, 2010 Share Posted February 12, 2010 That will work for the directory that it is in and subdirectory. Server restart is not necessarily. Quote Link to comment https://forums.phpfreaks.com/topic/191791-htaccess-file-help/#findComment-1011156 Share on other sites More sharing options...
teamatomic Posted February 12, 2010 Share Posted February 12, 2010 If its your own server just edit the httpd.conf file and add the extensions to the addType line, save the file and restart apache and you will not have to use an .htaccess file for each site you do. HTH Teamtomic Quote Link to comment https://forums.phpfreaks.com/topic/191791-htaccess-file-help/#findComment-1011207 Share on other sites More sharing options...
$Three3 Posted February 13, 2010 Author Share Posted February 13, 2010 If its your own server just edit the httpd.conf file and add the extensions to the addType line, save the file and restart apache and you will not have to use an .htaccess file for each site you do. HTH Teamtomic Hey thanks a lot for the replies. Ok I have tried everything you all have told me but when I upload the .htacces file to the www directory (the directory that is visible to the web), it does the weirdest thing. When i go to www.mysite.com/index.html it will download the index.html file. When i delete the .htaccess file, everything works perfectly again. Any one know why it is doing this? Here is my .htaccess file components: RemoveHandler .html .htm AddType application/x-httpd-php .php .htm .html .phtml Quote Link to comment https://forums.phpfreaks.com/topic/191791-htaccess-file-help/#findComment-1011803 Share on other sites More sharing options...
teamatomic Posted February 13, 2010 Share Posted February 13, 2010 Remove the Removehandler, you still want apache to handle htm-html files, you just want php to parse them also, thus the addition of the extensions to the php file type. HTH Teamatomic Quote Link to comment https://forums.phpfreaks.com/topic/191791-htaccess-file-help/#findComment-1011903 Share on other sites More sharing options...
teamatomic Posted February 13, 2010 Share Posted February 13, 2010 What you want to do is best done within the httpd.conf file. Find the mod_php5 block and make it look like this. <IfModule mod_php5.c> AddType application/x-httpd-php .php .htm .html .phtml AddType application/x-httpd-php .php3 AddType application/x-httpd-php-source .phps </IfModule> Thats all you have to do. Now htm/html files will be parsed by php. HTH Teamatomic Quote Link to comment https://forums.phpfreaks.com/topic/191791-htaccess-file-help/#findComment-1011911 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.