好吧,所以在IIS中这样做相对简单,但是我试图确保所有内容也都在Apache上运行。
Ok, so this is relatively straightforward to do in IIS, however I am trying to make sure everything runs on Apache too.
我需要转向 domain/?page=about (其中 page 是变量,而 about 是信息)到 domain/about
I need to turn domain/?page=about (where page is the variable and about is the information) into domain/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.
推荐答案
但是,我希望它将/?page = $ 1的任何内容重定向到/ $ 1,以便domain/?page=about变成domain/about
However, I want it to redirect anything that is /?page=$1 to just /$1 such that domain/?page=about turns into domain/about
然后您需要添加以下内容:
Then you'll need to add this:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /\?page=([^&\ ]+) RewriteRule ^/?$ /%1? [L,R=301]更多推荐
使用.htaccess隐藏变量
发布评论