Php .htaccess重定向丢失获取变量
这是我为MVC设置的htaccessPhp .htaccess重定向丢失获取变量,php,.htaccess,Php,.htaccess,这是我为MVC设置的htaccess <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?url=$1 [PT,L] </IfModule> 重新启动发动机
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1 [PT,L]
</IfModule>
重新启动发动机
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php?url=$1[PT,L]
因此,对localhost/users/的任何请求都将重定向到localhost?url=users/
但是当url中有一些get数据可用时,例如:localhost/users/?msg=hello
我在$\u GET['url']中缺少了?msg=hello。是否可以重定向到localhost/users/msg=hello/使用“QueryString Append”
选项
RewriteRule ^(.*)$ index.php?route=/$1 [QSA,L]
引用自:您试图做的事情将非常复杂。作为替代方案,您可以尝试以下方法:
RewriteRule ^(.*)$ index.php/$1 [PT,L]
使用该规则时,您可以通过$\u服务器['REQUEST\u URI']访问URL
丢失get参数的原因是服务器使用两个“?”创建URL。例:
http://localhost/?url=users/?msg=123