Welcome to WebmasterWorld Guest from 50.17.117.221

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Why do I get a 500 error on remote server but not on localhost?

     
2:05 pm on Apr 19, 2011 (gmt 0)

Junior Member

joined:Apr 19, 2011
posts: 42
votes: 0


I am probably too tired to see straight, but for some reason i get a 500 error when I upload this htaccess, while it works ok on my WAMP server.
Does anyone see what could be the problem?


# ---------------------------------------------------------
# Some extra security
# ---------------------------------------------------------

<Files ".htaccess">
order allow,deny
deny from all
</Files>

Options +FollowSymLinks

# ---------------------------------------------------------
# Prevent directory browsing & access to .dirs
# ---------------------------------------------------------

Options -Indexes
IndexIgnore *

<IfModule mod_rewrite.c>
RewriteRule "(^|/)\." - [F]
</IfModule>

# ---------------------------------------------------------
# Scripts
# ---------------------------------------------------------

Options +ExecCGI
AddHandler cgi-script cgi

Options +Includes
XBitHack on

# ---------------------------------------------------------
# Make sure we show te right page
# ---------------------------------------------------------

DirectoryIndex index.php index.html

# ---------------------------------------------------------
# MIME types (partly from html5 boilerplate)
# ---------------------------------------------------------

AddType audio/ogg oga ogg spx
AddType audio/flac flac
AddType video/ogg ogv
AddType video/mp4 mp4
AddType video/webm webm
AddType image/svg+xml svg svgz
AddEncoding gzip svgz
AddType application/vnd.ms-fontobject eot
AddType font/truetype ttf
AddType font/opentype otf
AddType application/x-font-woff woff
AddType image/x-icon ico
AddType application/x-httpd-php inc

# ---------------------------------------------------------
# Set Charset and Headers
# ---------------------------------------------------------

AddCharset UTF-8 .htm .html .php .inc .css .js .xml .json .rss

<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
<FilesMatch "\.(html|htm|php)$">
BrowserMatch MSIE ie
Header set X-UA-Compatible "IE=Edge,chrome=1" env=ie
Header set imagetoolbar "no" env=ie
</FilesMatch>
Header append Vary User-Agent
</IfModule>
</IfModule>

# ---------------------------------------------------------
# Configure cache-ing (css is dynamic)
# ---------------------------------------------------------

<ifModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 years"
<FilesMatch "\.(htm|html|xml|txt|php|inc)$">
ExpiresDefault "access plus 1 seconds"
</FilesMatch>
</ifModule>

<ifModule mod_headers.c>
Header unset ETag
Header unset Last-Modified
</ifModule>

FileETag None

# ---------------------------------------------------------
# Compression
# ---------------------------------------------------------

<IfModule mod_deflate.c>
<FilesMatch "\.(js|css|htm|html|xml|inc|php|ttf|otf|eot|svg)$">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>

# ---------------------------------------------------------
# Custom errors
# ---------------------------------------------------------

Options -MultiViews
2:14 pm on Apr 19, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


You have missed out the required RewriteEngine On line.

The options line should go near the RewriteEngine On line and you should combine all five lines into one.

Options +FollowSymLinks
Options -Indexes
Options +ExecCGI
Options +Includes
Options -MultiViews

becomes:

Options +FollowSymLinks -Indexes +ExecCGI +Includes -MultiViews


I don't use quotes:

RewriteRule "(^|/)\." - [F]

and prefer:

RewriteRule (^|/)\. - [F]

or similar.


The |htm|html| pattern simplifies to |html?| in several places.
2:41 pm on Apr 19, 2011 (gmt 0)

Junior Member

joined:Apr 19, 2011
posts: 42
votes: 0


Thanks, but that was not it.

I decided to remove all lines one by one and then add them again one by one. And the problem is with the lines:

Header set X-UA-Compatible "IE=Edge,chrome=1" env=ie
Header set imagetoolbar "no" env=ie

When I remove those it works again.
So now I have to figure out why those would trigger a 500?
2:52 pm on Apr 19, 2011 (gmt 0)

Junior Member

joined:Apr 19, 2011
posts: 42
votes: 0


Oh. Never mind. It seems the server runs Apache 1.3 :-( wow, dinosaurs.
3:07 pm on Apr 19, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


Ah, didn't think of that - but do fix the other issues too.
3:16 pm on Apr 19, 2011 (gmt 0)

Junior Member

joined:Apr 19, 2011
posts:42
votes: 0


I will, thanks.
7:19 pm on Apr 25, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


Apache 1.3.x supports mod_headers, so this is not likely a matter of an old Apache server, but rather of mod_headers not being loaded on this particular server.

First stop after an error is the server error log file, which often tells you exactly what's wrong... I don't see that info posted here.

Jim
8:01 pm on Apr 25, 2011 (gmt 0)

Junior Member

5+ Year Member

joined:June 26, 2007
posts: 88
votes: 0


It's not the headers module that is the problem it's the environment variables which are not supported in the older Apache version (env=ie) so that was probably the problem.