[英]htaccess file not working for wordpress pages
I'm trying to add a new rule in the htaccess file that will allow input of other
instead of the actual name of the page which is notify
. 我正在尝试在htaccess文件中添加新规则,该规则允许输入
other
而不是notify
页面的实际名称。 But I can't seem to get it to work. 但是我似乎无法使其正常工作。
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^other$ notify [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Also tried something like: 还尝试了类似的东西:
RewriteRule ^other$ index.php/notify [QSA]
and this: 和这个:
RewriteRule ^other$ /index.php/notify [QSA]
Also tried adding the rules from wordpress itself (inside the admin_init section of a plugin) and then refresh the rules by going to the permalinks settings, choosing post name and then save but no luck either. 还尝试从wordpress本身(在插件的admin_init部分内部)添加规则,然后通过转到永久链接设置,选择帖子名称然后保存但也没有运气来刷新规则。 Upon checking htaccess file it produced a rule similar to the above one:
检查htaccess文件后,它产生了与上述规则相似的规则:
add_rewrite_rule('other', 'index.php/notify', 'bottom');
I've verified that I can override the rules via the htaccess file in the root directory because when I tried to use an actual file in the server hello.php
我已经验证可以通过根目录中的htaccess文件覆盖规则,因为当我尝试在服务器
hello.php
使用实际文件时
RewriteRule ^other$ hello.php [QSA]
It works. 有用。 I just don't know why when I use a wordpress page it doesn't work.
我只是不知道为什么当我使用wordpress页面时它不起作用。 It also seems to work when I use the absolute path:
当我使用绝对路径时,它似乎也起作用:
RewriteRule ^other$ http://somesite.com/notify [QSA]
But this is no good because when I add some arguments to the URL (which is what I will ultimately do) I end up with bad looking URL when I do the above: http://somesite.com/?some_argument=some_value 但这不好,因为当我向URL添加一些参数时(最终将要这样做),当执行上述操作时,我的URL最终看起来很糟糕: http : //somesite.com/?some_argument=some_value
The current permalink setting in wordpress is set to post name. Wordpress中的当前永久链接设置被设置为帖子名称。 Any ideas what I have missed?
有什么想法我错过了吗?
Try this rule: 尝试以下规则:
RewriteRule ^other/?$ index.php?p=PAGE_ID [QSA]
Put the necessary PAGE_ID to redirect to 放置必要的PAGE_ID以重定向到
Hello may be you can use .htaccess plugin..! 您好,您可以使用.htaccess插件..! to control it from admin panel.
从管理面板进行控制。 I hope this Help you
希望这对您有帮助
http://wordpress.org/plugins/wp-htaccess-control/
http://wordpress.org/plugins/wp-htaccess-control/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.