如何重寫此URL?RewriteEngine隱藏擴展名和GET
http://website.com/file.php?lang=en 到 http://website.com/file/en
文件名和參數可以改變,我發現很多話題就把我沒有發現兩個擴展的組合和GET參數
更新:我得到這個工作隱藏PHP擴展現在如何添加參數
# Turn mod_rewrite on
RewriteEngine On
# hide .php extension
# To externally redirect /dir/file.php to /dir/file
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule^%1 [R=302,L]
# To internally forward /dir/file to /dir/file.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.php [L,QSA]