[英]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.