I told WordPress that I wanted urls to look like: domain.com/postname.html
我告诉WordPress我希望网址看起来像:domain.com/postname.html
I want to pass a parameter to a WordPress plugin. So when I get domain.com/postname.html.2 it is supposed to be domain.com/postname.html?tubepress_page=2
我想将参数传递给WordPress插件。所以,当我得到domain.com/postname.html.2时,它应该是domain.com/postname.html?tubepress_page=2
With the following the parameter is passed correctly, but not the name.
使用以下参数正确传递,但不传递名称。
This is the .htaccess
file:
这是.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>
So for URL domain.com/postname.html.2
The above .htaccess
basically works, it gives me the correct parameter to the script, but not the correct page, it gives me the latest WordPress post.
所以对于URL domain.com/postname.html.2以上.htaccess基本上有效,它给了我正确的脚本参数,但没有正确的页面,它给了我最新的WordPress帖子。
I think it somehow is missing the post name, but I don't know how to specify that in the RewriteRule.
我认为它错过了帖子名称,但我不知道如何在RewriteRule中指定它。
I get the same if I type: domain.com/.2 which gives me the latest post.
如果我打字,我会得到相同的:domain.com/.2,它给了我最新的帖子。
So what would be good domain.com/xyz.html.2 to be tubepress_page=2 for the page xyz and I don't want to specify xyz.html anywhere in the htaccess file, since I want to try to avoid typing in things for each new post I make.
那么对于页面xyz来说什么是好的domain.com/xyz.html.2是tubepress_page = 2并且我不想在htaccess文件中的任何地方指定xyz.html,因为我想尽量避免输入内容对于我制作的每个新帖子。
How do I specify it so that the post name variable is taken into consideration in the RewriteRule?
如何指定它以便在RewriteRule中考虑post name变量?
Any help on this would be very much appreciated.
任何有关这方面的帮助将非常感谢。
1 个解决方案
#1
Try this rule:
试试这条规则:
RewriteRule ^(.*\.html)\.([0-9]+)$ $1?tubepress_page=$2
#1
Try this rule:
试试这条规则:
RewriteRule ^(.*\.html)\.([0-9]+)$ $1?tubepress_page=$2