[英]Wordpress - extra 'pretty' parameter on the URL string. Mod_rewrite?
[英]Pass parameter to WordPress plugin with pretty url, mod_rewrite, .htaccess
我告诉WordPress,我希望网址看起来像: domain.com/postname.html
我想将参数传递给WordPress插件。 所以当我得到domain.com/postname.html.2时,应该是domain.com/postname.html?tubepress_page=2
使用以下参数可以正确传递参数,但不能正确传递名称。
这是.htaccess
文件:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^.*([0-9]+)$ /?tubepress_page=$1
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php
</IfModule>
因此,对于URL domain.com/postname.html.2
,上述.htaccess
基本上可以正常运行,它为脚本提供了正确的参数,但没有正确的页面,因此为我提供了最新的WordPress帖子。
我认为它以某种方式缺少职位名称,但是我不知道如何在RewriteRule中指定该名称。
如果键入:domain.com/.2,则得到的信息相同。
因此,对于页面xyz来说,domain.com/xyz.html.2最好是tubepress_page = 2,我不想在htaccess文件中的任何地方指定xyz.html,因为我想避免输入任何东西对于我发布的每个新帖子。
如何指定它,以便在RewriteRule中考虑帖子名称变量?
任何帮助,将不胜感激。
尝试以下规则:
RewriteRule ^(.*\.html)\.([0-9]+)$ $1?tubepress_page=$2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.