我無法弄清楚如何將這個URL改寫爲頁面和用戶配置文件的規則
http://localhost/site/page.php?id=[pagetitle]
改寫爲
http://localhost/site/page/title
和 用戶配置文件
http://localhost/site/profile.php?username=username
到
http://localhost/site/profile/username
這是我使用的代碼:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^profile(.*)$ profile.php?username=$1
RewriteRule ^(.*)$ page.php?title=$1
RewriteEngine敘述在 的RewriteCond%{} REQUEST_FILENAME!-f 的RewriteCond%{} REQUEST_FILENAME!-d 重寫規則^ profile(。*)$ profile.php?username = $ 1 RewriteRule ^( 。*)$ page.php?title = $ 1 – Dinho
你可以用它更新問題。它可能會給你一個更積極的分數 – Philibobby