301 ReDirects产生500内部服务器错误

时间:2014-04-07 12:47:26

标签: .htaccess redirect

每当这些301重定向被添加到.htaccess文件中时(后面的内容)我得到500内部服务器错误 - 并想出原因?

提前多多感谢...

理查德

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

# BEGIN Permanent URL redirects
Redirect 301 /about-cs.html www.christian-simpson.com/about-christian-simpson/
Redirect 301 /entrepreneurial-success.html www.christian-simpson.com/entrepreneurial-success/
Redirect 301 /advanced-thinking.html www.christian-simpson.com/advanced-thinking/
Redirect 301 /become-a-coach.html www.christian-simpson.com/become-a-coach/
Redirect 301 /speaking.html www.christian-simpson.com/speaking/
Redirect 301 /resources.html www.christian-simpson.com/resources/
Redirect 301 /praise.html www.christian-simpson.com/testimonials/
Redirect 301 /store.html www.christian-simpson.com/store/
Redirect 301 /contact.html www.christian-simpson.com/contact/
Redirect 301 /privacy.html www.christian-simpson.com/privacy-policy/
Redirect 301 /anti-spam.html www.christian-simpson.com/anti-spam-policy/
Redirect 301 /terms.html www.christian-simpson.com/terms-of-service/

# END Permanent URL redirects

1 个答案:

答案 0 :(得分:1)

几乎没有问题:

  1. 混合mod_aliasmod_rewrite规则。
  2. 目标URI中未使用http://
  3. 重写后保留重定向规则。
  4. 要解决此问题,您可以使用:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    
    # BEGIN Permanent URL redirects
    RewriteRule ^about-cs\.html$ /about-christian-simpson/? [L,R=301,NC]
    RewriteRule ^entrepreneurial-success\.html$ /entrepreneurial-success/? [L,R=301,NC] 
    # other 301 rules here
    
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress