Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/295.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 导致问题的简单规则_Php_Regex_Apache_.htaccess_Mod Rewrite - Fatal编程技术网

Php 导致问题的简单规则

Php 导致问题的简单规则,php,regex,apache,.htaccess,mod-rewrite,Php,Regex,Apache,.htaccess,Mod Rewrite,我们需要这种类型的URL:www.ourdomain.com/dev/kunde-first/service 重写为:www.ourdomain.com/dev/kunde first/inhalt.php?id=service 并在我们的.htaccess中使用此选项: RewriteEngine On RewriteBase /dev/kunde-first/ RewriteCond %{REQUEST_FILENAME} !.(jpg|jpeg|gif|png|css|js|ico|tx

我们需要这种类型的URL:www.ourdomain.com/dev/kunde-first/service

重写为:www.ourdomain.com/dev/kunde first/inhalt.php?id=service

并在我们的.htaccess中使用此选项:

RewriteEngine On
RewriteBase /dev/kunde-first/

RewriteCond %{REQUEST_FILENAME} !.(jpg|jpeg|gif|png|css|js|ico|txt|html|htm|xml|eot|woff|ttf|svg)$
RewriteCond %{REQUEST_FILENAME} !.(scripts/[^/]*)$

RewriteRule ^([A-Za-z0-9-]+) inhalt.php?id=$1 [NC,L] # process navigation
然而,当我们获取$\u GET['id']时,我们得到的是'inhalt'而不是'service'


任何帮助都将不胜感激

使用正确的正则表达式尝试此规则:

RewriteEngine On
RewriteBase /dev/kunde-first/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(\w+)/?$ inhalt.php?id=$1 [NC,L,QSA]

使用正确的正则表达式尝试此规则:

RewriteEngine On
RewriteBase /dev/kunde-first/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(\w+)/?$ inhalt.php?id=$1 [NC,L,QSA]