1and1 htaccess errors
The commented out google redirect is working but the rest of the rules dont work at all.
it automatically gives me a 500 internal server error. This only happens on the 1and1 server.
RewriteEngine On
Options FollowSymLinks
# RewriteRule ^(.*)$ http://www.google.com/$1 [r=301,nc]
RewriteRule ^(ajax)/([a-zA-Z0-9-z\-]+)$ http://mysite.com/index.php?ajax=$2 [r=301,nc]
RewriteRule ^([a-zA-Z0-9-z\-]+)/([a-zA-Z0-9-z\-]+)$ http://mysite.com/index.php?page=$1&subPage=$2
RewriteRule ^([a-zA-Z0-9-z\-]+)/([a-zA-Z0-9-z\-]+)/$ http://mysite.com/index.php?page=$1&subPage=$2
RewriteRule ^repairs/([a-zA-Z0-9-z\-]+)/([a-zA-Z0-9-z\-]*)$ http://mysite.com/repairs-engine.php?page=repairs&subPage=$1&pitem=$2
RewriteRule ^([a-zA-Z0-9-z\-]+)$ http://mysite.com/index.php?page=$1
RewriteRule ^([a-zA-Z0-9-z\-]+)/$ http://mysite.com/index.ph开发者_Go百科p?page=$1
Any thoughts?
Thanks
For exact error description you should check the Apache's error log.
What this pattern supposed to mean
[a-zA-Z0-9-z\-]
?? It is definitely wrong. It should be[a-zA-Z0-9\-]
-- I'm pretty sure that this is the reason for error.
NOTES:
If using
[NC]
flag, then no need to havea-zA-Z
-- justa-z
will be enough.If doing rewrite (internal redirect, when URL changes in browser's address bar) and not proper redirect (301, 302 etc), then no need to use full domain name.
In any case, I suggest adding
[L]
flag to all rules -- it will speed up processing by tiny bit.
have you tried not to escape the last dash in the char class block?
like this:
^([a-zA-Z0-9-]+)$
精彩评论