Apache htaccess results in files being downloaded instead of displayed
Posted
by
chrissik
on Pro Webmasters
See other posts from Pro Webmasters
or by chrissik
Published on 2013-11-16T14:22:01Z
Indexed on
2014/06/03
3:43 UTC
Read the original article
Hit count: 419
So I had this "beautiful" website that did exactly what I wanted it to do. Then I shut down my PC, reboot and...the pages just download now instead of being displayed.
I re-installed XAMPP and launched Apache again and I was able to identify the .htaccess file as the cause of the problem.
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{QUERY_STRING} !^desktop
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|iphone|ipod|#opera mobile|palmos|webos" [NC]
RewriteRule ^/?$ /mobile/index [L,R=302]
RewriteRule ^/?$ /de/index [R]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html
Here is the problem I guess:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html
This should make it possible to use /de/index
instead of /de/index.html
- but somehow it causes the page to download if I open localhost/de/index
(but with localhost/de/index.html
it works fine...).
I'm using HTML Sites with SSI Elements on a Apache web server. The only other file that is different to the out-of-the-box ones is the httpd.conf, where I enabled SSI:
AddType text/html .shtml
AddHandler server-parsed .shtml
AddHandler server-parsed .html
AddHandler server-parsed .htm
Options Indexes FollowSymLinks Includes
AddOutputFilter INCLUDES .shtml
Options +Includes
So I hope there is somebody among you that can help me with this annoying problem as I'm quite desperate... for some reason, even without the problematic lines Chrome keeps downloading the files (even if I delete the .htaccess file), while IE and Opera display the pages.
Edit: Now Opera also wants to download files (whether index.html or index are called).
© Pro Webmasters or respective owner