我们想要这种类型的URL:www.ourdomain.com/dev/kunde-frs/service
改写为:www.ourdomain.com/dev/kunde-frs/inhalt.php?id=服务
并且正在我们的中使用它。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
然而,当我们获取$_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]