Why am I getting a 500 internal error instead of 404?

833 views Asked by At

I basically added a line ErrorDocument 404 /404.php in my htaccess file so I can redirect 404 to the 404.php file but now my site is getting a 500 internal server error. Below is my htaccess file. What is wrong ?

AddHandler php-script .html .htm php_flag magic_quotes_gpc on
Options +FollowSymlinks

<IfModule mod_expires.c>
# Enable expirations
ExpiresActive On 
# Default directive
ExpiresDefault "access plus 1 month"
# My favicon
ExpiresByType image/x-icon "access plus 1 year"
# Images
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
# CSS
ExpiresByType text/css "access 1 month"
# Javascript
ExpiresByType application/javascript "access plus 1 year"
</IfModule>




<IfModule mod_rewrite.c>
RewriteEngine On
ErrorDocument 404 /404.php
RewriteCond %{HTTP_HOST} ^[^.]*\.[^.]*$
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Redirect 301 /classified/ad/  mysiteurl/free-stuff/
Redirect 301 /free-ads/  mysiteurl/free-stuff/
RewriteCond %{HTTP_HOST} !^www.mysite.com$ [NC]
RewriteRule ^(.*)$ mysiteurl/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^22\.233\.937\.216
RewriteRule (.*) mysiteurl/$1 [R=301,L]
RewriteCond %{HTTP_USER_AGENT} libwww-perl.* 
RewriteRule .* – [F,L]
</IfModule>



RewriteRule ([^/]+)-([^/]+)-([^/]+)-([^/]+)\.htm$ listing.php?subcatId=$4
RewriteRule ([^/]+)-([^/]+)-([^/]+)\.htm$ listing.php?subcatId1=$3
RewriteRule ([^/]+)-([^/]+)\.htm$ listing.php?catId=$2
RewriteRule ([^/]+).htm$ listing.php?country=$1
RewriteRule message/([^/]+)/ send-message.php?ad_id=$1
RewriteRule free-classified-ads/([^/]+)/([^/]+)/ classified-details.php?ad=$1
RewriteRule annonces/([^/]+)/([^/]+)/ details.php?ad=$1
RewriteRule anuncios/([^/]+)/([^/]+)/ details.php?ad=$1
RewriteRule anúncios/([^/]+)/([^/]+)/ details.php?ad=$1
RewriteRule annunci/([^/]+)/([^/]+)/ details.php?ad=$1
RewriteRule kleinanzeige/([^/]+)/([^/]+)/ details.php?ad=$1
RewriteRule annons/([^/]+)/([^/]+)/ details.php?ad=$1
RewriteRule μικρές-αγγελίες/([^/]+)/([^/]+)/ details.php?ad=$1
RewriteRule объявления/([^/]+)/([^/]+)/ details.php?ad=$1
RewriteRule реклама-Обяви/([^/]+)/([^/]+)/ details.php?ad=$1
RewriteRule reklama/([^/]+)/([^/]+)/ details.php?ad=$1
RewriteRule advertentie/([^/]+)/([^/]+)/ details.php?ad=$1
RewriteRule Հայտարար/([^/]+)/([^/]+)/ details.php?ad=$1
RewriteRule in/([^/]+)/([^/]+)/ details.php?ad=$1
RewriteRule seri/([^/]+)/([^/]+)/ details.php?ad=$1



AddDefaultCharset utf-8


# compress text, html, javascript, css, xml:
<IfModule mod_deflate.c>
  # Compress HTML, CSS, JavaScript, Text, XML and fonts
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
  AddOutputFilterByType DEFLATE application/x-font
  AddOutputFilterByType DEFLATE application/x-font-opentype
  AddOutputFilterByType DEFLATE application/x-font-otf
  AddOutputFilterByType DEFLATE application/x-font-truetype
  AddOutputFilterByType DEFLATE application/x-font-ttf
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE font/opentype
  AddOutputFilterByType DEFLATE font/otf
  AddOutputFilterByType DEFLATE font/ttf
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/xml

  # Remove browser bugs (only needed for really old browsers)
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  Header append Vary User-Agent
</IfModule>
1

There are 1 answers

16
Jamie Bonnett On

Because you are getting redirected to the 404.php file, I believe that you will have an error within that file and not the .htaccess.

I could help you more if you posted the contents of the 404.php.