[英]how to hide .php .html extension using .htaccess
How do I remove or hide php extension? 如何删除或隐藏php扩展名? using .htaccess? 使用.htaccess?
2 Example URL : 2示例网址:
http://localhost/folder/test.php?id=1&company=ABC&address=AAAAA HTTP://localhost/folder/test.php ID = 1&公司= ABC和地址= AAAAA
http://localhost/folder/test2.php?username=abcd HTTP://localhost/folder/test2.php用户名= ABCD
Thank You 谢谢
Add this code in .htaccess
for html
and php
extension 将此代码添加到.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
for query string add these lines Try this 对于查询字符串,请添加以下行试试
RewriteRule ^(folder)/(\d+)/([^/.]+)$ test.php?id=$1&company=$2&address=$3 [L]
Try This 尝试这个
RewriteRule ^(folder)/(\d+)/([^/.]+)$ test?id=$1&company=$2&address=$3 [L]
Try this 尝试这个
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]
i have add every possible solution 我已经添加了所有可能的解决方案
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.