繁体   English   中英

htaccess文件不适用于wordpress页面

[英]htaccess file not working for wordpress pages

我正在尝试在htaccess文件中添加新规则,该规则允许输入other而不是notify页面的实际名称。 但是我似乎无法使其正常工作。

# 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

还尝试了类似的东西:

RewriteRule ^other$ index.php/notify [QSA]

和这个:

RewriteRule ^other$ /index.php/notify [QSA]

还尝试从wordpress本身(在插件的admin_init部分内部)添加规则,然后通过转到永久链接设置,选择帖子名称然后保存但也没有运气来刷新规则。 检查htaccess文件后,它产生了与上述规则相似的规则:

add_rewrite_rule('other', 'index.php/notify', 'bottom');

我已经验证可以通过根目录中的htaccess文件覆盖规则,因为当我尝试在服务器hello.php使用实际文件时

RewriteRule ^other$ hello.php [QSA]

有用。 我只是不知道为什么当我使用wordpress页面时它不起作用。 当我使用绝对路径时,它似乎也起作用:

RewriteRule ^other$ http://somesite.com/notify [QSA]

但这不好,因为当我向URL添加一些参数时(最终将要这样做),当执行上述操作时,我的URL最终看起来很糟糕: http : //somesite.com/?some_argument=some_value

Wordpress中的当前永久链接设置被设置为帖子名称。 有什么想法我错过了吗?

尝试以下规则:

RewriteRule ^other/?$ index.php?p=PAGE_ID [QSA]

放置必要的PAGE_ID以重定向到

您好,您可以使用.htaccess插件..! 从管理面板进行控制。 希望这对您有帮助

http://wordpress.org/plugins/wp-htaccess-control/

暂无
暂无

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

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