Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/294.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php .htaccess url重写不会返回整个url_Php_Regex_Apache - Fatal编程技术网

Php .htaccess url重写不会返回整个url

Php .htaccess url重写不会返回整个url,php,regex,apache,Php,Regex,Apache,.h我使用的访问规则- RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/\.]+)/?$ profile.php?user=$1 [L] RewriteRule ^(.*)$ profile.php?user=$1 [QSA,NE] 正确示例- http://mydomain.com/http://fatalweb.com/art

.h我使用的访问规则-

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/\.]+)/?$ profile.php?user=$1 [L]
RewriteRule  ^(.*)$ profile.php?user=$1 [QSA,NE]
正确示例-

http://mydomain.com/http://fatalweb.com/articles/8/definitions-for-htaccess-regex-character
传递给$1的值是-
http://fatalweb.com/articles/8/definitions-for-htaccess-regex-character

http://mydomain.com/https://www.google.com/search?q=_get&ie=utf-8&oe=utf-8&aq=t
传递给$1的值是-
https:/www.google.com/search


如何确保整个url
https://www.google.com/search?q=_get&ie=utf-8&oe=utf-8&aq=t
以及所有查询参数都被传递到$1

在您的问题中,是不是
https:/www.google.com/search
https://
后缺少一个斜杠

在使用空文件处理程序之前,至少需要指定一条规则。不知道为什么,但这就是它的工作原理。请针对您的用例查看以下内容:

RewriteEngine On
RewriteRule ^([^/]*)\.dummy$ ./?dummy=$1&%{QUERY_STRING} [L]
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ ./%{QUERY_STRING}
RewriteRule^([^/]*)\.dummy$./?dummy=$1&%{QUERY\u STRING}[L]
是空的。检查并看看这是否对您有效!:)