Forum Moderators: phranque

Message Too Old, No Replies

configuring mod_rewrite

         

colm_c

1:38 pm on Jul 25, 2005 (gmt 0)

10+ Year Member



ok here's the story, I've just setup a test server for our site so that I can make changes on the test server without screwing up the live site. So I've set up my Linux / PHP / MySQL and all works well no problems.

However our live site uses mod_rewrite in the .htaccess file, and I'm trying to emulate it here with no joy, I'm getting 500 errors with the simpliest rules in my .htaccess file -- all the rules work on the live site (shared hosting environment)

I think it's an error in my httpd.conf -- the LoadModule rewrite_module modules/mod_rewrite.so was already uncommented.

What else do I need to do to recreate how the host is configured for mod_rewrite?

jdMorgan

2:38 pm on Jul 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



colm_c,

It would be very helpful to us if you would examine your server error log and post the contents of the log entry for one of these 500-Server Errors. Often, the error log entry will tell you precisely what is wrong.

You'll need to set "AllowOverride" in httpd.conf to include "FileInfo" and "Options". You'll need to set "Options" in httpd.conf or .htaccess to include "FollowSymLinks" or "SymLinksIfOwnerMatch". I recommend you look up these directives in Apache core [httpd.apache.org] before adding them.

Jim

colm_c

3:44 pm on Jul 25, 2005 (gmt 0)

10+ Year Member



Hi jdMorgan,

Here's what the logs are saying:

[Mon Jul 25 16:45:07 2005] [alert] [client 192.168.1.143] /var/www/html/.htaccess: Illegal option RewriteEngine

And I have set
Options Indexes FollowSymLinks
AllowOverride All

in my httpd.conf file already

and here's the .htaccess file (test version)

Options +FollowSymLinks
RewriteEngine On

RewriteRule ^test /test.php

jdMorgan

8:04 pm on Jul 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



And I have set
Options Indexes FollowSymLinks
AllowOverride All

in my httpd.conf file already


Those are backwards. Reverse the order.

and here's the .htaccess file (test version)

Options +FollowSymLinks
RewriteEngine On

RewriteRule ^test /test.php

If you have FollowSymLinks in httpd.conf, you won't need it in .htaccess. Your rule, as written, will loop on itself, since the substitution URL matches the pattern. Also, you should use an [L] flag (see mod_rewrite documentation) unless you have reason to do otherwise. Try:


RewriteRule ^test\.html$ /test.php [L]

JIm