开发者

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


  1. For exact error description you should check the Apache's error log.

  2. 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:

  1. If using [NC] flag, then no need to have a-zA-Z -- just a-z will be enough.

  2. 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.

  3. 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-]+)$

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜