这是的.htaccess节是否正确? [英] Is this .htaccess section correct?

查看:74
本文介绍了这是的.htaccess节是否正确?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经建立在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.

这篇关于这是的.htaccess节是否正确?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆