Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

RewriteEngine and 500 err, who can I solve it?

I get a 500 Internal Server Error when trying to use the RewriteEngine



8:02 pm on Mar 11, 2006 (gmt 0)

5+ Year Member

Hi, im trying to implement an url rewrite, but i get this message:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@test.egoblogs.net and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

How can i fix that?


8:29 pm on Mar 11, 2006 (gmt 0)

10+ Year Member

Make sure that mod_rewrite is in fact enabled on your server.

First place to check is httpd.conf and look for a line similar to this:
LoadModule rewrite_module modules/mod_rewrite.so

If it is commented out, you will need to uncomment it and restart Apache/httpd

And instead of arbitrarily enabling mod_rewrite via htaccess if that is what you are doing, it is best to at least use a module check if/then construct to avoid the 500 error ie:
<IfModule mod_rewrite.c>
RewriteEngine on
...your rewrite stuff here...

That way if you try a rewrite rule and the resultant URL, if mod_rewrite isn't enabled, you'll just get a 404 "Not Found" instead of a 500 error.


9:07 pm on Mar 11, 2006 (gmt 0)

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

The easiest way to track down a 500 server error is to look in your error_log file which is probably located in /var/log/httpd/. There is a 99% chance you'll find a decent English language description in that file telling you where the server encountered an error.


9:10 pm on Mar 11, 2006 (gmt 0)

5+ Year Member

Thanks for the quick help! Problem solved.


7:18 pm on Mar 12, 2006 (gmt 0)

5+ Year Member

Mmm.. a new 500 error showed up. When i use this two rewriteRules by separated, there's no problem, but when i combine them, it resolves a 500 err.

# search
RewriteRule ^s/([^/]+)/?$ /search.php?s=$1 [L]
# links
RewriteRule ^(.*)$ /index.php [L]

This is the error printed in the log:
[error] File does not exist: /home2/mysite/public_html/test/404.shtml

Any ideas on how to fix the htaccess? What i need to accomplish is this:

any URIs that start with /s/ redirect to the search results page, any OTHER URI redirects to the index.php.

www.mysite.com/s/hello/ ---> search.php?s=hello
www.mysite.com/about_us/ ---> index.php


Featured Threads

Hot Threads This Week

Hot Threads This Month