Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.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查询字符串不';我不再工作了_Php_.htaccess - Fatal编程技术网

Php HTACCESS查询字符串不';我不再工作了

Php HTACCESS查询字符串不';我不再工作了,php,.htaccess,Php,.htaccess,我正在HTACCESS for Custom PHP网站中使用下面的代码块。当我在脚本上回显p1变量时,会得到如下值: 专辑/混音大师-38 而p1的值应仅为 相册 当我将p2值回显为空时,p2值的值应该是 mix-master-38 HTACCESS Options +FollowSymlinks ## Mod_rewrite in use. RewriteEngine on ## Prevent Directory List

我正在HTACCESS for Custom PHP网站中使用下面的代码块。当我在脚本上回显p1变量时,会得到如下值:

专辑/混音大师-38

而p1的值应仅为

相册

当我将p2值回显为空时,p2值的值应该是

mix-master-38

HTACCESS

        Options +FollowSymlinks

        ## Mod_rewrite in use.
        RewriteEngine on

        ## Prevent Directory Listing
        IndexIgnore *

        # ---- Make pages render without their extension in the url
        Options +MultiViews

        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^(.*/([a-zA-Z0-9_-]+)|([a-zA-Z0-9_-]+))$ ./index.php?p1=$1&p2=$2&p3=$3&p4=$4&p5=$5 [L]
        RewriteRule ^(.*/([a-zA-Z0-9_-]+)|([a-zA-Z0-9_-]+))$ ./index.php?p1=$1&p2=$2&p3=$3&p4=$4 [L]
        RewriteRule ^(.*/([a-zA-Z0-9_-]+)|([a-zA-Z0-9_-]+))$ ./index.php?p1=$1&p2=$2&p3=$3 [L]
        RewriteRule ^(.*/([a-zA-Z0-9_-]+)|([a-zA-Z0-9_-]+))$ ./index.php?p1=$1&p2=$2 [L]
        RewriteRule ^(.*/([a-zA-Z0-9_-]+)|([a-zA-Z0-9_-]+))$ ./index.php?p1=$1 [L]

正则表达式开头的
*
与相册部分匹配。要单独捕获它,您可以将其放在括号中,因此您需要:
^((.*)/([a-zA-Z0-9_-]+)|([a-zA-Z0-9_-]+)$

请注意,此更改将移动偏移量,因此您可能希望更改$1->$2,依此类推,或者使外括号不捕获