【发布时间】:2019-12-10 00:11:28
【问题描述】:
我希望能够重写以下网站结构,使其适用于主域,然后适用于所有子目录。
domain.ltd
| | wp-content
| | themes
| | theme01
| | core
| | web.php # http://domain.ltd/wp-content/themes/theme01/core/web.php
|
|- subsite1
| | wp-content/themes/theme02/core
| | web.php # http://domain.ltd/subsite1/wp-content/themes/theme02/core/web.php
|
|- subsite2
| | wp-content/themes/theme03/core
| | web.php # http://domain.ltd/subsite2/wp-content/themes/theme03/core/web.php
我有以下.htaccess 规则:
RewriteRule ^([_0-9a-zA-Z-])/ws/(.*) /wp-content/themes/$1/core/$2
但我不知道为什么它不匹配。我曾尝试使用https://htaccess.madewithlove.be 测试仪,但找不到正确的模式。
基本上我希望网址是:
http://domain.ltd/ws/web.php
http://domain.ltd/subsite1/ws/web.php
http://domain.ltd/subsite2/ws/web.php
【问题讨论】:
-
在这里使用类似我的解决方案可能会有所帮助stackoverflow.com/questions/57467883/…
标签: php wordpress .htaccess url-rewriting