How To Fix Mod_rewrite 500 Internal Server Error On .htaccess File Apache

Forums » Linux Systems » How To Fix Mod_rewrite 500 Internal Server Error On .htaccess File Apache
these are instructions to show you step by step on how to fix a 500 error on your browser when you are using Apache mod rewrite for Linux using the shell terminal commands. will show you the commands you will need to fix if you get a 500 error on your web
ok, so today, i wanted to start making my urls more search engine friendly (SEO), i wrote my .httaccess file and made the changes on my files to make sure the urls are as i put them in the .htacess file. when i tried to open my urls, i kept getting this Apache 500 error:

Internal Server Error

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

Please contact the server administrator, webmaster 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.
Apache/2.2.0  Server at Port 80

I remember a whie back ago i got this same error on another apache server. so what i had to do was look at the /etc/httpd/conf/httpd.conf file make sure i uncomment the mod_rewrite, so i logged into the linux shell and opened the httpd.conf file:

nano /etc/httpd/conf/httpd.conf

When i open it, found that the mod_rewrite was not commented out, so wha else could be the problem, as you can see,
LoadModule rewrite_module modules/ the is not commented out in the httpd.conf file:


LoadModule speling_module modules/
LoadModule userdir_module modules/
LoadModule alias_module modules/
LoadModule rewrite_module modules/
LoadModule proxy_module modules/
LoadModule proxy_balancer_module modules/
LoadModule proxy_ftp_module modules/
LoadModule proxy_http_module modules/
LoadModule proxy_connect_module modules/

so what else could be the problem i wondered...
Then i checked for AlloweOverride :

<Directory />
    Options FollowSymLinks
    AllowOverride None

I changed AllowOverride from None to All, rebooted the server and i still kept getting the 500 error. at this point i was breaking my head..
so i checked my .htaccess file again to make sure i didn't make a typo or something, so this is how my .htacces files looks like:

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^p-([0-9]*).html viewpage.php?id=$1

So i removed the Options +FollowSymLinks then uploaded it my site, and voala! i didn't get the error anymore. so this is how my .htaccess file looks like now:

RewriteEngine on
RewriteRule ^p-([0-9]*).html viewpage.php?id=$1

Thanks to the support team at for helping me with this problem, i had read a post regarding this on this fourm but could not get a resolution on the problems.

Thanks Webune for your support on my dedicated server. - that's what i call service.

UPDATE: note, you will get this error when you have a syntax error in your .htaccess files, so double check your spelling, you will find that you mispelled something. the reason is because apache cannot recognize the code you put in your .htaccess file. one way you can confirm its a bad syntax in your .htaccess file, is try removing all the code and then try your website again without any code in the .htaccess file, if it doesnt give you an 500 error, then you know for sure you have a bad syntax in your .htaccess file.
thanks a lot for this post. really helped.
you saved my day!!!!!
thanks a lot!!!
i did same changes above but it did not worked for me....:(
bit of a bandaid solution eh? great for the people who do not want to use the followsymlinks option, but what about the people that do?
thank u very match

i maked that on my web site and now working fine

you have to enable overriding: "allowoverride all" in your apache configuration for the respective domain to fix the problem.
thank u very match

i maked that on my web site and now working fine

fantastic solution!

thank you so very much from barcelona,spain ;)
great!!! so much thanks and greetings from mexico city, but i have one more trouble, rewrite doesn't work :'(

it redirect me at 404 page :(

my .htaccess code is:

rewriteengine on
rewriterule ^profile/(.*)$ profile.php?dirid=$1 [l,nc]
seems to have worked! your awesome!
i have htaccess file gives internal error 500 vbulletin forums can you help
hello i was attempting to use mod rewrite on uniserver but got 500 internal server error does that mean my apache mod re write module is not working for me. and how do i need to install it to fix this proble?
nice & clear article.helped me to solve my problem
the perblerm is permisson or the perl is
not running right if you are using perl
the scripts will no load read /var/
is where the log are
didn't work for me, i did in the default file
allowoverride all

hi, i am facing this problem frm long time but now it is working fine..thanks for your help and support..

i dont get it!when i go to myspace home it says 'sorry please try again' and it says 500 Internal Server Error
I`ve read few of articles here and could say it was really interesting, thanks for sharing that.
Thank you. It solved my issue.
Hello When i am going for any thing edit in htaccss . It reflects same 500 internal server errir.
Thanksss..!! You save my day~!!!
mine is that when i load my site url, it gives me a blank page??????? How can i resolve this
That's so interesting , but when i modified the config file, my server still off line !!! i couldn't restart it !!
Thanks heaps mate! I was almost banging my head on the desk when your advice came and saved the day.
Thanks! I solve a lot of thinks with this!
can u bring me a detail of this tutorial ?
please,,, because I am newbie ... :D
i tried what you did and i didn't have to remove my Options +FollowSymLinks from my htaccess file. My fix was I had an auth script in my htaccess, cause i have a project that I want password i commented that out and it works! But thanks for the tip so that i could fix it. :) kudos
it was SOOOO SIMPLE just to uncomment one line... I spent hours trying to fix it... Thanks!
Thank you very much, your comments about Error 500 helped me to resolve my problem with Prestashop and Apache Server, God bless you.
Title: How To Fix Mod_rewrite 500 Internal Server Error On .htaccess File Apache [2877]
Tags: how to fix mod rewrite 500 internal server error on htaccess file apache
Comments 30
Visits 35263