簡體   English   中英

將舊的PHP鏈接重定向到.htaccess中的wordpress鏈接

[英]Redirect old php link to wordpress link in .htaccess

我正在嘗試使用.htaccess將舊頁面鏈接重定向到新的wordpress鏈接,我嘗試了以下兩個重定向步驟,但它們均無效。

兩者都位於同一域中,例如www.example.com/folder/first-index.php?idTop=0www.example.com/foldernew/products-list/

Redirect 301 "/folder/first-index.php?idTop=0" "/foldernew/products-list/"
RedirectPermanent /folder/first-index.php?idTop=0 /foldernew/products-list/ 

我正在嘗試其他步驟,但是沒有運氣。 請任何人更正我的代碼。 謝謝。

請嘗試這個。 它可能會幫助您。

[code autolinks=”false”]
# 301 redirect for main pages
RedirectMatch 301 ^/Your_old_path/$ http://Your_new_path/
[/code]

您可以嘗試以下方法:

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/folder/first-index\.php$
RewriteCond %{QUERY_STRING} ^idTop=([0-9]*)$
RewriteRule ^(.*)$ /foldernew/products-list/ [R=301,L]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM