Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/250.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.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
htaccess重写不允许PHP获取_Php_.htaccess_Mod Rewrite - Fatal编程技术网

htaccess重写不允许PHP获取

htaccess重写不允许PHP获取,php,.htaccess,mod-rewrite,Php,.htaccess,Mod Rewrite,我的htaccess文件中有以下内容: RewriteCond %{REQUEST_URI} ^/customer/ [OR] RewriteCond %{HTTP_HOST} ^my\.domain\.com$ [NC] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}.php -f RewriteRule ^(.*)$ /customer/index.php?p=$1.php [L]

我的htaccess文件中有以下内容:

RewriteCond %{REQUEST_URI} ^/customer/ [OR]
RewriteCond %{HTTP_HOST} ^my\.domain\.com$ [NC]
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}.php -f
RewriteRule ^(.*)$ /customer/index.php?p=$1.php [L]
它将类似于
domain.com/contacts/viewcontact.php的内容重写为
domain.com/contacts/viewcontact

当我去域名的时候

domain.com/contacts/viewcontact?seq=123

然后在PHP
echo$_GET[“seq”]它没有显示任何内容

我也尝试过使用

domain.com/contacts/viewcontact&seq=123


但这会显示未找到页面

您的
重写规则
重置查询字符串(
?p=$1.php
),但不会附加现有查询字符串。将该标志添加到您的规则中,它会将请求中的查询字符串附加到新的查询字符串中,这应该可以满足您的需要。

但是为什么
/index.php?p=viewcontact.php
而不是
/viewcontact.php