简体   繁体   English

网址改写带问号

[英]url rewrite with a question mark

I want to change this url: 我想更改此网址:

mydomain. com/?root=yes 

to: mydomain. 到:mydomain。 com/ com /

I can't figure out how to deal with the question mark. 我不知道如何处理问号。

You can add a ? 您可以添加一个? followed by nothing inside the rewrite rule to indicate that mod_rewrite should clear the query string while rewriting. 重写规则中没有任何内容,表示在重写时mod_rewrite应该清除查询字符串。 Example: 例:

RewriteCond %{QUERY_STRING} ^root=yes$
RewriteRule ^$ index.php? # index.php will receive an empty querystring
<?php
if(isset($_GET['root']) && $_GET['root'] == 'yes')
{
    header('Location: http://mydomain.com');
}

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

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