xProteuSx Posted December 16, 2011 Share Posted December 16, 2011 I have XAMPP set up on my machine, and I currently have two projects that I am working on in my 'htdocs' directory. One is in '\htdocs\project1' and the other is in '\htdocs\project2'. Both projects use a .htaccess file to allow PHP parsing in a .HTML file. The same one-line .htaccess file exists in the root directory of both projects. The line is: AddHandler application/x-httpd-php5 .html .php .htm .shtml This .htaccess file works in the '\htdocs\project1' folder, but does not work in the '\htdocs\project2' folder. That is to say, project1 .HTML files are parsed for PHP. However, in project2 the PHP code appears as text instead of being parsed as PHP. What is going on? I went through a lot of trouble to get the .htaccess file to work for project1, back when that was my sole project. Now it looks like I am back to the drawing board for project2. How infuriating! Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/253294-htaccess-issue-in-xampp/ Share on other sites More sharing options...
Deoctor Posted December 16, 2011 Share Posted December 16, 2011 Have you tried restarting the apache module Quote Link to comment https://forums.phpfreaks.com/topic/253294-htaccess-issue-in-xampp/#findComment-1298485 Share on other sites More sharing options...
xProteuSx Posted December 16, 2011 Author Share Posted December 16, 2011 Yeah, I've restarted, reinstalled, rebooted. I've taken project 2 out altogether, and put project 1 straight into the \htdocs\ folder, as in \htdocs\index.html and still nothing. However, I've tested a few things out: This is my .htaccess file: AddHandler application/x-httpd-php5 .html .php .htm .shtml ErrorDocument 400 /400.html ErrorDocument 401 /401.html ErrorDocument 403 /403.html ErrorDocument 404 /404.html ErrorDocument 500 /500.html The ErrorDocument lines work. So if I type in a non-existent page, such as adasdfasdf.html, it does take me to the /404.html page, as stated in the .htaccess file, so it looks like it is reading and implementing some of the settings there. So now I'm thinking that the following line is not working: AddHandler application/x-httpd-php5 .html .php .htm .shtml Its ALWAYS worked before, so now I don't know what is happening. Quote Link to comment https://forums.phpfreaks.com/topic/253294-htaccess-issue-in-xampp/#findComment-1298491 Share on other sites More sharing options...
xProteuSx Posted December 16, 2011 Author Share Posted December 16, 2011 I've figured it out. The .htaccess file was being read, as I discovered. For some reason the following line, which always worked for me, didn't work anymore: AddHandler application/x-httpd-php5 .html .php .htm .shtml I found a replacement, which appears to be universally functional: <FilesMatch "\.(htm|html|php)$"> SetHandler application/x-httpd-php </FilesMatch> When I put this nonsense into the .htaccess file, all was well. Quote Link to comment https://forums.phpfreaks.com/topic/253294-htaccess-issue-in-xampp/#findComment-1298495 Share on other sites More sharing options...
Deoctor Posted December 16, 2011 Share Posted December 16, 2011 ok but try this also as well RemoveHandler .html .htm AddType application/x-httpd-php .php .htm .html Quote Link to comment https://forums.phpfreaks.com/topic/253294-htaccess-issue-in-xampp/#findComment-1298498 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.