multisite - Rewriting request to another site

I have a multisite WP instance set up to use subdirectories. I have a few pages that should have URLs on each site. The

I have a multisite WP instance set up to use subdirectories. I have a few pages that should have URLs on each site. The content will be (almost) the same, so I wanted to just make the pages once and rewrite requests to them from other sites. Allowing for future expansion, I thought I'd rewrite all pages that start with a given pattern ("foo-" in my example) to a common site. For example:

should rewrite to

.php?pagename=foo-path&market=dallas ,

and

should rewrite to

.php?pagename=foo-path&market=el-paso ,

but

should rewrite to .php?pagename=bar-path as usual.

Reading up on the problem, I don't think it's possible to rewrite the request to another site using add_rewrite_rule(), which is a shame, because I was trying to make a plugin to solve this problem. Can anyone confirm or deny this?

Presuming it's not possible to do what I describe with add_rewrite_rule(), I'll have to modify .htaccess. It's currently at the default for WP subdirectory multisite; can anyone offer a suggestion on how to modify it to meet my goal?

Update: I tried adding the following condition and rule to my .htaccess:

RewriteCond %{REQUEST_URI} !^/common-site/ [NC]
RewriteRule ^([_0-9a-zA-Z-]+)/?(foo-.+)$ common-site/$2?market=$1

When I look at the mod_rewrite log, it seems to be working:

rewrite 'dallas/foo-path/' -> 'common-site/foo-path/?market=dallas'

but I get a 404, even though foo-path exists on common-site.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744839770a4596484.html

相关推荐

  • multisite - Rewriting request to another site

    I have a multisite WP instance set up to use subdirectories. I have a few pages that should have URLs on each site. The

    2天前
    60

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信