WordPress Multisite子域名RewriteRules .htaccess

时间:2017-01-30 09:45:11

标签: wordpress .htaccess redirect subdomain multisite

我想将一些旧网址重定向到新网址,我也希望将其用于子网域,但我很难完成这项工作。我错过了.htaccess中的某些内容吗?重定向不会对我的主站点起作用,但子域也不起作用。

另一个问题。

如果我想重定向子域名,但子域​​名为domain mapped,例如sub.domain.com => anotherdomain.com,我是否必须使用原始SUB域进行重定向,还是使用映射域名?

这是我的.htaccess

# BEGIN WordPress
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]

    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) wp/$2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ wp/$2 [L]
    RewriteRule . index.php [L]
</IfModule>
# END WordPress

重定向主网站main blogsite

RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com [nc]

#Redirect 'domain.com/about_us.html' to 'domain.com/about-us'
RewriteRule ^about_us\.html$ /about-us/ [R=301,L]

重定向子域名

RewriteCond %{HTTP_HOST} ^anotherdomain\.com [nc]

#Redirect 'anotherdomain.com/projects.html' to 'anotherdomain.com/projects/summary/'
RewriteRule ^projects\.html$ /projects/summary/ [R=301,L]

0 个答案:

没有答案
相关问题