现代重写隐藏文件夹 [英] Mod Rewrite Hide Folder
问题描述
我觉得这是一个pretty简单的问题。
I think this is a pretty simple question.
你怎么一个apache重写隐藏的文件夹。
How do you an apache rewrite to hide a folder.
EX:www.website.com/pages/login.php到www.website.com/login.php~~V
EX: www.website.com/pages/login.php to www.website.com/login.php
或www.website.com/pages/home.php到www.website.com/home.php~~V
or www.website.com/pages/home.php to www.website.com/home.php
文件夹需要永久被隐藏。谢谢
The folder needs to alway be hidden. thanks
推荐答案
我假设你想要的是浏览器请求/home.php但服务器实际使用位于/pages/home.php文件,右键?如果是这样,这应该工作:
I assume what you want is for the browser to request /home.php but the server to actually use the file located at /pages/home.php, right? If so, this should work:
确保Apache的mod_rewrite模块安装。然后,使用在Apache配置这样的事情,虚拟主机配置,或(不太理想).htaccess文件:
Make sure the apache mod_rewrite module is installed. Then, use something like this in your apache config, virtual host config, or (less desirable) .htaccess file:
RewriteEngine On
RewriteRule ^/(.*)$ /pages/$1
该规则使用常规的前pressions,所以你可能想看看关于这一主题的参考,如果你不确定。阅读手动(RewriteCond指令是非常有用的)或规则选项。
The rules use regular expressions, so you may want to look at a reference on that topic if you're unsure. Read the manual for more info on other directives (RewriteCond can be very useful) or rule options.
这篇关于现代重写隐藏文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!