Jump to content
Larry Ullman's Book Forums

Code For Htaccess File Causes 500 Error


Recommended Posts

When I add the following code to my htaccess file according to the instructions starting at page 193, I'm getting a 500 error when I try to access my webpage.

 

My web host hasn't been able to provide me with any answers. Any ideas?

 

 

 

RewriteEngine on
# For sales:
RewriteRule ^shop/sales/?$ sales.php
# For the primary categories:
RewriteRule ^shop/([A-Za-z\ ] )/?$ shop.php?type=$1
# For specific products:
RewriteRule ^browse/([A-Za-z\ \-] )/([A-Za-z\ \-] )/([0-9] )$ browse.php?type=$1&category=$2&id=$3
# For HTTPS pages:
RewriteCond %{HTTPS} off
RewriteRule ^(checkout\.php|billing\.php|final\.php|admin/(.*))$ https://%{HTTP_HOST}/$1 [R=301,L]



Link to comment
Share on other sites

  • 1 year later...

I am also getting an Internal 500 Error, and just cant seem to figure out why. I am copying the code straight from the printed book. When i don't have the .htaccess uploaded then the page shows up fine, but no links work. I would greatly appreciate any help. thank you!

 

Here is the 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@allthatteases.johnnybrunerdesigns.com 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 Server at www.allthatteases.com Port 80

Here is my code:

 

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^allthatteases\.com
RewriteRule ^(.*)$ http://www.allthatteases.com/$1 [R=permanent,L]
# For sales:
RewriteRule ^shop/sales/?$ sales.php
# For the primary categories:
RewriteRule ^shop/([A-Za-z\+]+)/?$ shop.php?type=$1
# For specific products:
RewriteRule ^browse/([A-Za-z\+\-]+)/(A-Za-z\+\-]+)/([0-9]+)$ browse.php?type=$1&category=$2&id=$3
# For HTTPS pages:
RewriteCond %{HTTPS}off
RewriteRule ^(checkout\.php|billing\.php|final\.php|admin/(.*))$ https://%{HTTP_HOST}/$1[R=301,L]
</IfModule>

Link to comment
Share on other sites

Generally when you have these 500 errors, there's no indication of which thing is causing the problem. I'd start by removing your two lines for redirecting to www. and see if that makes the error go away. If not, keep removing lines until the 500 error leaves, and then you've got the culprit.

Link to comment
Share on other sites

 Share

×
×
  • Create New...