簡單的問題...根據本教程:URL Rewriting我想製作一個簡單的重定向規則。我正在測試服務器上工作,因此該網站位於域的子目錄中:http://my-server.de/lcbs。我想將http://my-server.de/lcbs/index重定向到http://my-server.de/lcbs/index.php?page=news&parent=lcbs。所以I'm使用此規則:使用.htaccess在mod_rewrite默認重定向
RewriteEngine On
RewriteRule ^lcbs/index?$ lcbs/index.php?page=news&parent=lcbs
現在,當我想開http://my-server.de/lcbs/index,出現此錯誤:
The requested URL /lcbs/index was not found on this server.
如果我將其更改爲下面的代碼:
RewriteEngine On
RewriteRule ^index?$ index.php?page=news&parent=lcbs
出現此錯誤:
The requested URL /var/www/lcbs.de/public_html/index.php was not found on this server.
我做錯了什麼?我認爲這不是一件大事... 謝謝!
什麼的'意圖'附近的'RewriteRule' _pattern_結束? – MrWhite
@ w3dk要回答評論 - 我忘了斜線,在URL的末尾有可選的斜槓。因此:'RewriteRule^index /?$ index.php?page = lcbs' – Fabman22