我想以這種方式實現url localhost/mysite/contact /沒有php擴展名,並在最後添加了尾部斜線但它不工作。刪除php文件擴展名
這是代碼示例:
RewriteRule ^([^/]+)/$ $1.php
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]
我如何能實現如下: 本地主機/ mysite的/頁/ 任何幫助嗎? 謝謝。
您的PHP是以「http:// localhost/mysite/contact.php」的身份訪問的嗎? – anubhava
這是正確的。這是http://localhost/mysite/contact.php – test