Too many redirects in [removed]

后端 未结 2 731
鱼传尺愫
鱼传尺愫 2021-01-28 23:23

I want to make a redirect 301 from an old ulr to a new url.

old url: /php/zend-framework/captcha-codigo-anti-spam-zend-framework

new url: http

相关标签:
2条回答
  • 2021-01-28 23:44

    It looks like both URI's are on the same host (www.demo31.com), so when you use RedirectMatch, the part of the URI that matches is part of the redirect. Example

    If I go to:

    http://www.demo31.com/php/zend-framework/captcha-codigo-anti-spam-zend-framework
    
    1. The URI is /php/zend-framework/captcha-codigo-anti-spam-zend-framework
    2. The RedirectMatch directive matches the URI, redirects to:

      http://www.demo31.com/blog/php/zend-framework/captcha-codigo-anti-spam-zend-framework
      
    3. new URI is /blog/php/zend-framework/captcha-codigo-anti-spam-zend-framework
    4. however, the RedirectMatch directive matches the URI again since it contaings /php/zend-framework/captcha-codigo-anti-spam-zend-framework

    Try changing RedirectMatch to just Redirect. Or if you only want that specific URI to redirect (as opposed to something like /php/zend-framework/captcha-codigo-anti-spam-zend-framework/some/other/stuff also getting redirected, add a few delimiters:

    RedirectMatch 301 ^/php/zend-framework/captcha-codigo-anti-spam-zend-framework$   http://www.demo31.com/blog/php/zend-framework/captcha-codigo-anti-spam-zend-framework
    

    (the ^ and $

    0 讨论(0)
  • 2021-01-28 23:47
    RewriteRule ^bad_url$ good_url [R=301,L] 
    

    Thx ! works for me

    0 讨论(0)
提交回复
热议问题