[英]how to hide .php .html extension using .htaccess
如何刪除或隱藏php擴展名? 使用.htaccess?
2示例網址:
HTTP://localhost/folder/test.php ID = 1&公司= ABC和地址= AAAAA
HTTP://localhost/folder/test2.php用戶名= ABCD
謝謝
將此代碼添加到.htaccess
以獲取html
和php
擴展名
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L] //for php extension
RewriteRule ^([^\.]+)$ $1.html [NC,L] //for html extension
對於查詢字符串,請添加以下行試試
RewriteRule ^(folder)/(\d+)/([^/.]+)$ test.php?id=$1&company=$2&address=$3 [L]
嘗試這個
RewriteRule ^(folder)/(\d+)/([^/.]+)$ test?id=$1&company=$2&address=$3 [L]
嘗試這個
RewriteRule ^/?([a-zA-Z_]+)/([a-zA-Z_0-9]+)$ test?id=$1&company=$2&address=$3 [L]
RewriteRule ^/?([a-zA-Z_]+)/([a-zA-Z_0-9]+)$ test2?username=$1 [L]
我已經添加了所有可能的解決方案
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.