Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.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 需要mod_重写规则的帮助吗_Php_Apache_.htaccess_Mod Rewrite - Fatal编程技术网

Php 需要mod_重写规则的帮助吗

Php 需要mod_重写规则的帮助吗,php,apache,.htaccess,mod-rewrite,Php,Apache,.htaccess,Mod Rewrite,这是我的.htaccess: 有人能帮我定义一下规则吗?谢谢 试试这个。重写规则的问题在于它只匹配组成单词的单词字符。它在第一个/处终止。另外,结尾还有一个$,这不是绝对必要的。可能重复的感谢只需编辑$-变量:RewriteRule上的RewriteEngine^\.htaccess$-[F]RewriteBase/RewriteRule^\w+$index.php?main=$1 RewriteRule^\w+/\w+$index.php?main=$1&sub1=$2 RewriteRule

这是我的.htaccess:

有人能帮我定义一下规则吗?谢谢


试试这个。重写规则的问题在于它只匹配组成单词的单词字符。它在第一个/处终止。另外,结尾还有一个$,这不是绝对必要的。

可能重复的感谢只需编辑$-变量:RewriteRule上的RewriteEngine^\.htaccess$-[F]RewriteBase/RewriteRule^\w+$index.php?main=$1 RewriteRule^\w+/\w+$index.php?main=$1&sub1=$2 RewriteRule^\w+/\w+/\w+$index.php?main=$1&sub1=$2&sub2=$3没有捕获模式引用,它们确实从1开始,0通常指整个匹配。
<IfModule mod_rewrite.c>    
RewriteEngine On
RewriteRule ^\.htaccess$ - [F]
#RewriteBase /
RewriteRule ^(\w+)$ index.php?main=$0
</IfModule>
http://www.test.de/Categorie/A/1        index.php?main=$0&sub1=$1&sub2=$2
<IfModule mod_rewrite.c>    
RewriteEngine On
RewriteRule ^\.htaccess$ - [F]
#RewriteBase /
RewriteRule ^(\w+)$ index.php?main=$1
RewriteRule ^(\w+)/(\w+)$ index.php?main=$1&sub1=$2
RewriteRule ^(\w+)/(\w+)/(\w+)$ index.php?main=$1&sub1=$2&sub2=$3
</IfModule>