Thomas Freeborough
Thomas Freeborough

Reputation: 26

Mod Rewrite generating 500 internal error on page

For some reason my .HTACCESS file won't re-write my users page, even though I'm sure the code to re-write it is correct.

I want to turn

http://www.tfreeb.com/user/user?user=duenna

Into

http://www.tfreeb.com/user/duenna

And this is my HTACCESS file, could it be that something else is conflicting with it?

The re-write rule for the user page is right at the bottom.

Options -Indexes

php_flag display_startup_errors on
php_flag display_errors on
php_flag html_errors on
php_flag  log_errors on
php_value error_log  /home/path/public_html/domain/PHP_errors.log

php_value error_reporting 32767


ErrorDocument 404 /notfound.html
ErrorDocument 403 /403.html

RewriteEngine On

RewriteCond %{HTTP_HOST} !^www.tfreeb.com$ [NC]
RewriteRule ^(.*)$ http://www.tfreeb.com/$1 [L,R=301]

RewriteCond %{HTTP_USER_AGENT} libwww-perl.* 
RewriteRule .* – [F,L]

RewriteCond %{HTTP_HOST} ^213\.143\.20\.122
RewriteRule (.*) http://www.tfreeb.com/$1 [R=301,L]



RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]

RewriteEngine On
RewriteRule ^user/([^/]*)$ /user/user.php?user=$1 [L]

Upvotes: 0

Views: 62

Answers (2)

Croises
Croises

Reputation: 18671

After:

RewriteRule (.*) http://www.tfreeb.com/$1 [R=301,L]

Try with that:

RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]

RewriteRule ^user/([^/]*)$ /user/user.php?user=$1 [NC,L]
RewriteRule ^([^.]+)$ $1.php [NC,L]

No need to use multiple times RewriteEngine On

Upvotes: 1

user45949
user45949

Reputation: 2570

Are you sure that the .htaccess is being read?

I'd try to make a basic redirect to some page, p.e. google.com if this doesn't work you should ask to the web server admin to give you the AllowOverride = all directive for the directory.

p.e.

<directory /var/www/mysite>
    AllowOverride = all
</directory>

Upvotes: 0

Related Questions