Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest sNews - sNews 1.7 - with its own forums - for discussion and user mods.

Author Topic: 500 Server Error with aliased domains caused by .htaccess  (Read 1628 times)

ad_267

  • Jr. Member
  • **
  • Karma: 7
  • Posts: 57
500 Server Error with aliased domains caused by .htaccess
« on: May 27, 2008, 11:16:21 pm »

Hi

I'm trying to get a website working with aliased domains. The main domain works fine but these all return a 500 internal server error. If I remove the .htaccess file in the root directory then I can resolve the home page of the site and don't get this error.

Here's my .htaccess file, it's been modified to allow for multiple languages from this thread: http://snewscms.com/forum/index.php?topic=5039.0

Code: [Select]
<IfModule mod_php4.c>

    php_value session.use_trans_sid 0

</IfModule>

<IfModule mod_security.c>

SecFilterEngine Off

SecFilterScanPOST Off

</IfModule>

Options -Indexes

RewriteEngine On
#RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z][a-z])/index.php?(.*)$ $2 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z][a-z])/$ index.php?lang=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z][a-z])/(.*)$ index.php?lang=$1&category=$2 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z][a-z])/([a-z_]+)/([^/]+)$ index.php?lang=$1&category=$2&title=$3 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z][a-z])/([a-z_]+)/([^/]+)/([^/]+)/$ index.php?lang=$1&category=$2&title=$3&commentspage=$4 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z][a-z])/([a-z0-9_-]+)/([0-9]+)/$ index.php?lang=$1&category=$2&nbsp;articlespage=$3 [L]

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*) $1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?category=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z_]+)/([^/]+) index.php?category=$1&title=$2 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z_]+)/([^/]+)/([^/]+)/ index.php?category=$1&title=$2&commentspage=$3 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z0-9_-]+)/([0-9]+)/ index.php?category=$1&nbsp;articlespage=$2 [L]

Hopefully someone can point out what I'm doing wrong.

Cheers,
Adam
Logged

Joost

  • Guest
Re: 500 Server Error with aliased domains caused by .htaccess
« Reply #1 on: May 28, 2008, 12:42:32 am »

In general a 500 error means, there is something in .htaccess that is not allowed in this server configuration.
First thing I would try, is deleting the "ifmodule" part or Options -Indexes.

Run a file with the following code, to see if mod_rewrite is enabled

Code: [Select]
<?php
phpinfo
();
?>
Logged

ad_267

  • Jr. Member
  • **
  • Karma: 7
  • Posts: 57
Re: 500 Server Error with aliased domains caused by .htaccess
« Reply #2 on: May 28, 2008, 07:20:47 am »

mod_rewrite is definitely enabled because the website works fine from the main domain, it is only the aliased domains that don't work. I've removed everything except the url rewriting and the problem persists so I'm pretty sure it's a problem with that somewhere.

Edit:
If I add this:
RewriteCond %{HTTP_HOST} !^.*maindomain.com$ [NC]
RewriteRule ^/?(.*)$ http://www.maindomain.com/$1 [R,L]

Then requests for the aliased domains are redirected to the main domain, but this isn't what I want. I want the url rewriting to work for any domain without being redirected.
« Last Edit: May 28, 2008, 11:11:15 am by ad_267 »
Logged