这是的.htaccess节是否正确?这是、是否正确、htaccess

2023-09-02 01:07:08 作者:谁要走我的心

我已经建立在Dreamhost的我的话preSS安装的基础.htaccess文件,但它似乎并不奏效呢。想直接任意要求7 PAGE_ID到43页ID。

I have created a .htaccess file in the base of my wordpress installation on dreamhost, but it doesn't seem to be working yet. Want to direct any requests to page_id of 7 to the page id of 43.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule http://www.myapp.com/?page_id=7 /?page_id=43 [NC,L]
</IfModule>

其实,我需要做任何事情来触发Apache来挑这个了太多,不仅仅是保存文件等?任何一种方式来看待日志文件条目,以帮助脚点的问题?

Actually do I need to do anything to trigger apache to pick this up too, other than just saving the file? Any way to look for log file entries to help pin point the issue?

推荐答案

请尝试以下操作:

RewriteEngine On
RewriteCond %{QUERY_STRING} page_id=7
RewriteRule ^(.*)$ /?page_id=43 [NC,L]

通过这个规则集,你也可以有很多更具体化,例如提供了指向同一个页面,等一个可选的pretty的URL。

With this ruleset you can also be a lot more specific by e.g. providing an optional pretty URL that pointed to the same page, etc.