0

when I try to make 301 redirect I get an internal error code 500:

Rewriterule ^categoy/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)? product_detail.php?category=$1&subcategory=$2&product=$4 [QSA,NC]

RewriteMap fiel:

RewriteMap lc int:tolower
RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule (.*) ${lc:$1} [R=301,L]

any suggestion why I get this error ?

thanks

3 Answers3

1

When you get a 500 error from Apache, Apache will make a note of why it gave you that error in your error_log, wherever that is configured to go. Refer to the error message in that log to find out what you're doing wrong.

tylerl
  • 14,885
  • 7
  • 49
  • 71
1

RewriteMap directives aren't allowed within .htaccess file. It should be written in Apache's configuration file httpd.conf.

0

okay... lets get some things straight.

Rewriterule ^categoy/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)? product_detail.php?category=$1&subcategory=$2&product=$4 [QSA,NC]

theres a lot of redundant stuff in here as for example NC does case insensitive matching anyway.. i formatted your code a bit:

RewriteMap lc int:tolower 
RewriteCond %{REQUEST_URI} [A-Z] 
RewriteRule (.*) ${lc:$1} [R=301,L]

which rule are you talking about now? from your title (301) i think the second one. your rewritecondition looks weird. but however the most common reason for an error 500 in relation to rewrite rules is lacking permissions. make sure you do AllowOverride All in your server config or move your rules there (which gives more performance than in htaccess files)

The Shurrican
  • 2,230
  • 7
  • 39
  • 58