![](/img/trans.png)
[英]Regex to redirect 301 a folder and all posts from that folder in Wordpress
[英]Redirect 301 all files from a folder to one file?
今天是個好日子,
在我的Wordpress網站上,我有一個插件可以通過virtual site.com/go/abc123xyz樣式鏈接傳輸外部鏈接。
我已經刪除了該插件,但顯然,當我檢查了G網站站長工具后,所有這些虛擬鏈接都出現了許多“未找到”錯誤。
我要做的就是將所有/ go / links重定向到一個特定的外部鏈接。 我正在尋找一個重定向規則,該規則會將所有鏈接從虛擬/ go /文件夾重定向到我指定的鏈接。
如果有人能幫助我,我將非常感謝。 謝謝!
嘗試添加:
RewriteRule ^go/(.*) www.mysitedotcom/out/link.php?id=$1 [R=301,NC,L]
到您的默認htaccess文件:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
所以它應該看起來像這樣:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^go/(.*) /out/link.php?id=$1 [R=301,NC,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
我希望能回答您的問題並為您提供幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.