.htaccess 301 redirect not working?

前端 未结 1 480
有刺的猬
有刺的猬 2021-01-19 17:29

I have a static page of the form page1.html in my root directory and another page index.php also in the root directory. What I am trying to do is move all old incoming links

相关标签:
1条回答
  • 2021-01-19 18:03
    1. Don't mix mod_rewrite rules and mod_alias rules.
    2. Keep redirect rules before default WP rule.

    Use this DocumentRoot/.htaccess (one level above wordpress directory):

    RewriteEngine On
    
    RewriteRule ^(page1|page2)\.html?$ /wordpressInstallation/ [L,NC,R=301]
    

    And remove Redirect directives from your Wordpress .htaccess.

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