正如@markkaplen所建议的,最好将这个非WordPress文件存储在文件系统的不同区域,并在中重写URL.htaccess. 而不是在物理目录结构中模仿WordPress URL,这可能只会导致(更多)问题(不仅仅是您需要覆盖WordPress前端控制器)。
例如,不要将非WordPress页面保存在/city/pricing/index.php, 将其保存在/non-wordress/city-pricing.php (例如)或/non-wordress/city/pricing/index.php (如果在开发过程中复制路径结构有帮助,但这对生成的URL没有影响,因为最终用户完全不知道该目录结构)。
然后在.htaccess <在WordPress前控制器之前(即# BEGIN WordPress 第节)您可以执行以下操作:
RewriteRule ^city/pricing/$ /non-wordpress/city-pricing.php [L]
这将在内部重写
/city/pricing/ 到
/non-wordpress/city-pricing.php - 这对最终用户是完全隐藏的。
但要强调的是,这个必须放在WordPress前端控制器之前,否则你只会得到404。