如何使用的.htaccess来隐藏URL文件夹名称 [英] how to hide folder name from url using .htaccess
本文介绍了如何使用的.htaccess来隐藏URL文件夹名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个域example.com我想重定向到example.com/public~~V但/公共文件夹应该隐藏的网址。
I have a domain example.com i want to redirect it to example.com/public but /public folder should hide from the url.
我使用的是下面的code在.htaccess重定向,但无法隐藏文件夹名称
I am using the below code in .htaccess to redirect, but unable to hide the folder name
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
RewriteRule ^$ public [L]
请帮我出了这个问题。
推荐答案
试试这个
RewriteEngine On
RewriteRule (.*) public/$ [QSA,L]
这篇关于如何使用的.htaccess来隐藏URL文件夹名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文