简体   繁体   English

.htaccess使用相同的永久链接结构从子文件夹重定向到主域

[英].htaccess redirect from subfolder to main domain with same permalink structure

Current I just finished migrating a WordPress site with the url www.boingnet.com/purl/ for the WordPress install. 目前,我刚刚完成了使用url www.boingnet.com/purl/迁移WordPress网站进行WordPress安装的操作。 After migrating to a new server and changing the url to www.boingnet.com I am looking for a way to redirect all traffic from the old site to the new site and keep all digital assets. 迁移到新服务器并将URL更改为www.boingnet.com之后,我正在寻找一种将所有流量从旧站点重定向到新站点并保留所有数字资产的方法。

http://www.boingnet.com/purl/pricing/ http://www.boingnet.com/purl/pricing/

would go to.... 会去...

http://www.boingnet.com/pricing/ http://www.boingnet.com/pricing/

Put this code in your .htaccess under DOCUMENT_ROOT directory: 将此代码放在DOCUMENT_ROOT目录下的.htaccess

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^www\.boingnet\.com$ [NC]
RewriteRule ^purl/(.*)$ /$1 [L,R=301,NC]
 RewriteRule ^purl/(.*) /$1 [R,L]

应该做到的。

Create .htaccess file in " pricing " folder , it contains those lines: 在“ price ”文件夹中创建.htaccess文件,其中包含以下几行:

     RewriteEngine on
     RewriteRule (.*)$ /purl/$1 [R=301,L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM