homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

RewriteEngine and 500 err, who can I solve it?
I get a 500 Internal Server Error when trying to use the RewriteEngine

5+ Year Member

Msg#: 5760 posted 8:02 pm on Mar 11, 2006 (gmt 0)

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?



10+ Year Member

Msg#: 5760 posted 8:29 pm on Mar 11, 2006 (gmt 0)

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.


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

Msg#: 5760 posted 9:07 pm on Mar 11, 2006 (gmt 0)

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.


5+ Year Member

Msg#: 5760 posted 9:10 pm on Mar 11, 2006 (gmt 0)

Thanks for the quick help! Problem solved.


5+ Year Member

Msg#: 5760 posted 7:18 pm on Mar 12, 2006 (gmt 0)

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

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved