繁体   English   中英

涉及index.php的Wordpress重写规则不起作用

[英]Wordpress rewrite rule involving index.php doesn't work

在开始之前,我想说的是,我确实搜索了与我的问题类似的主题并尝试了提供的所有解决方案,但是我的问题仍然存在,因此我不得不发表自己的问题。

无论如何,在我们的wordpress网站内,我们有一个名为site.com/shops的页面,我们想为其添加一个参数。 之后,我们要使用重写规则,以便site.com/tx将加载site.com/?pagename=shops&state=tx。 我们把它放在我们的.htaccess文件中:

RewriteRule ^tx(/)?$ index.php?pagename=shops&state=tx[L]

由于某些原因,它无法像我们预期的那样工作。 我通过将它更改为来检查index.php是否是问题

RewriteRule ^tx(/)?$ test.php?pagename=shops&state=tx[L]

那行得通,所以我相信问题是如果使用index.php则行不通。 如何使用index.php使其工作? TIA。

用下面的代码替换.htaccess代码

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress_test/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress_test/index.php [L]
</IfModule>

我希望这是可行的

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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