问题描述
好吧,所以在IIS中这样做相对简单,但是我试图确保所有内容也都在Apache上运行。
Ok, so this is relatively straightforward to do in IIS, however I am trying to make sure everything runs on Apache too.
我需要转向 http://domain.com/?page=about
(其中 page
是变量,而 about
是信息)到 http://domain.com/about
I need to turn http://domain.com/?page=about
(where page
is the variable and about
is the information) into http://domain.com/about
希望所有链接都被自动更改(因此,如果链接用于?page = about
,则它将更改为 about
。 )
I also want all links to automatically be changed (so if the link is for ?page=about
it gets changed to about
.)
这可能比我做的要简单,但是对于我的一生,我无法弄清楚。
This is probably simpler than I am making it but for the life of me I can't figure it out.
推荐答案
然后您需要添加以下内容:
Then you'll need to add this:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /\?page=([^&\ ]+)
RewriteRule ^/?$ /%1? [L,R=301]
这篇关于使用.htaccess隐藏变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!