简体   繁体   中英

Wordpress Multisite with multiple domains and redirects with one .htaccess

We run a Wordpress Multisite installation with a about 15 different websites all on their own domain. On one of those sites we want to migrate to a new theme that uses custom post types and migrate some of the content to these new custom post types. Because of this migration some links will break, usually this is easily solvable with a 301 redirect in .htaccess.

The nature of a multisite install just gives us a single .htaccess and when I create a simple redirect like this:

Redirect 301 /testredirect http://www.testredirect.com

Every single domain will redirect this link to testdirect.com and not just the one we just migrated. Can we fix this in this single .htaccess or is there some other way?

The easiest option would probably be a switch to Mod_Rewrite, as you can add conditions (RewriteCond ....) to each redirection rule eg.

RewriteEngine On

RewriteCond %{HTTP_HOST} www.testredirect.com
RewriteRule /testredirect  /  [R=301,L]

我们使用了用于Wordpress的重定向插件和一些正则表达式解决了我们的麻烦: https : //www.wordpress.org/plugins/redirection/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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