新网站的301重定向

时间:2019-09-05 09:36:46

标签: php html wordpress apache .htaccess

我已将wordpress网站迁移到html网站。我想将wordpress网址重定向到现有的html网址。我已经在新的html项目文件中创建了.htaccess。

旧网址https://test.testproject.net/aboutus/rewards-and-recognitions.html 新网址https://test.testproject.net/features/rewards-and-recognitions.html

旧网址https://test.testproject.net/events/upcoming-events-archive.html 新网址https://test.testproject.net/events.html

旧网址https://test.testproject.net/product-overview/rewards-recognition.html 新网址https://test.testproject.net/features/rewards-recognition.html

旧网址https://test.testproject.net/features/ 新网址https://test.testproject.net/features.html

.htaccess
 ErrorDocument 404 /not-found.html
 Options -Indexes
  Redirect aboutus/rewards-and-recognitions.html  http://test.testproject.net/features/rewards-recognition.html   [R=301,L]

我已将hta​​ccess写入新的html文件夹路径中,以将所有旧的网址转换为新的网址。

Redirect aboutus/rewards-and-recognitions.html  http://test.testproject.net/features/rewards-recognition.html   [R=301,L] //shows forbidden error

如何为所有以上从旧重定向到新的url编写htaccess

1 个答案:

答案 0 :(得分:0)

Redirect 301 [new_page] [old_page]

打开您的.htaccess文件。在第一个带有方括号的值中,键入旧页面。在第二个页面中,键入新页面。访问网站后,这会将用户重定向到新页面。对于您的情况,您应该输入。

 Redirect 301 aboutus/rewards-and-recognitions.html 
 http://test.testproject.net/features/rewards-recognition.html