admin管理员组文章数量:1410725
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.
本文标签: multisiteRewriting request to another site
版权声明:本文标题:multisite - Rewriting request to another site 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744839770a2627851.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论