[英]Wordpress rewrite : Redirect page to Home page
我有一个网址为http://mydomain.com/home/的wp页面。 我想使用htaccess将其重定向到http://mydomain.com/ 。
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^home/$ index.php [L] #This is my attempt to redirect; not working.
RewriteRule . /index.php [L]
</IfModule>
在默认的wp htaccess规则集之外写入规则。 请尝试以下方法:
RewriteRule ^home/(.*) http://mydomain.com/$ [L]
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
只需在wordpress阅读设置中将首页设置为首页即可。 那应该不用apache mod_rewrite
使用301重定向,是永久性的,对SEO有利
RedirectMatch 301 ^/home($|/.*) $1
在我的本地主机上测试了这个:)
/ home / home / / home /?blahblah
这全部重定向到/保留正确的部分查询字符串
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.