Php 导致问题的简单规则
我们需要这种类型的URL:www.ourdomain.com/dev/kunde-first/service 重写为:www.ourdomain.com/dev/kunde first/inhalt.php?id=service 并在我们的.htaccess中使用此选项: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
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]