[removed] in .htaccess causes 500 server error (Redirect to non-URL)

后端 未结 4 535
孤独总比滥情好
孤独总比滥情好 2021-01-05 04:28

have such kind of error.

When adding Redirect 301 rule to .htaccess file like:

Redirect 301 \"/page1.html\" \"/dir1/\"


        
相关标签:
4条回答
  • 2021-01-05 04:42

    Changed all Redirect 301 rules to:

    RewriteRule ^/page1.html$ /dir1/page.html [R=301,L]
    

    now working. But how does it work on production?

    0 讨论(0)
  • 2021-01-05 04:46

    I had same issue, for me this didn't work as well:

    RewriteRule ^/page1.html$ /dir1/page.html [R=301,L]
    

    What worked for me is to remove the leading slash, and add soft tailing slash with ?, like this:

    RewriteRule ^(page1.html)/?$ dir1/page.html [R=301,L]
    
    0 讨论(0)
  • 2021-01-05 04:58

    Please try this, it's working as expected.

     <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteBase /
      Redirect 301 /our_clients/nike /project/nike-nofyme-campaigns
     </IfModule>
    
    0 讨论(0)
  • 2021-01-05 05:02

    For me, I had the exact same issue. Adding "http://domain.com" in front of "/mypage" worked; I am still testing to get it to work without, as is does on my production server. So my .htaccess on my local testing environment, went like this:

    BROKEN: Redirect 301 /mypage /directory1/sub-directory/mypage/

    FIXED: Redirect 301 http://mydomain.com/mypage http://mydomain.com/directory1/sub-directory/mypage/

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