我们需要此类网址: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
然而,当我们获取$ _GET ['id']时,我们得到'inhalt'而不是'service'。
非常感谢任何帮助!
答案 0 :(得分:1)
使用正确的正则表达式尝试此规则:
RewriteEngine On
RewriteBase /dev/kunde-first/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(\w+)/?$ inhalt.php?id=$1 [NC,L,QSA]