DocumentRoot的背后MOD-重写加载文件(Mod-Rewrite loading files behind the DocumentRoot)

   IT问题网   2018-11-08 00:00:00

问 题

我用的.htaccess 和的mod_rewrite 指向驻留在documentroot的隐藏文件。我的文件夹结构如下所示:

 家用/
webroot公司/
other_files /
 

我有一个的.htaccess 文件根目录包含以下内容:

rewriteengine叙述上
重写规则^(。*)$ /家庭/ other_files / $ 1

如果我尝试访问 http://example.com/file.html 我收到以下错误:

所请求的网址/home/other_files/file.html在此服务器上找到。

它甚至有可能加载位于documentroot的隐藏文件?如果是的话,可以有人点我在正确的方向?

解决方案

我相信你需要用

添加一个节
 目录"/家/ other_files"
(选项)
 /目录
 

到apache在你的服务器配置将能够从中起到什么。举个例子,我的documentroot是/ var / www但本节中的默认提供网站:

 别名/ doc /"的/ usr /共享/ doc /"
目录"的/ usr /共享/ doc /"
选择多视图索引了followsymlinks
设置allowoverride无
订单拒绝,允许
所有拒绝
从127.0.0.0/255.0.0.0允许:: 1/128
 /目录
 

您可以再重写url去/ doc /,服务器会知道从哪里获取的文件。

标签:背后暗地里重写加载文件



分享:

  • 微信
  • QQ好友
  • QQ空间
  • 新浪微博


热门推荐

什么是L的[QSA,L] htaccess的(What is L in [QSA, L] in htaccess)

problem qsa means that if there's a query string passed ...

在Mac OSX上安装的CakePHP:apache的问题(install CakePHP on Mac osx: apache problems)

problem first time cake user and i'm having real apache p ...

的1and1 mod_rewrite的问题(1and1 mod_rewrite issues)

problem i'm currently trying to have my 1and1 host an .ht ...

如何摆脱PHP扩展在.htaccess中(How to get rid of .php extension in .htaccess)

problem i am trying to do a mod-rewrite in my .htaccess t ...

我怎样才能获得用户的输入使用的htaccess / htpasswd的时候?(How can I get a user's input when using htaccess/htpasswd)

problem i want to create a log in system using htaccess ...

字preSS自定义查询字符串和放大器; pretty的网址 - 如何?(Wordpress custom Querystrings & Pretty URL's - How)

problem i have a perfectly good (so far) setup of wordpre ...

阿帕奇的.htaccess:如何从URL如果不是'ID =(。*)`删除问号?(Apache .htaccess: How to remove question mark from URL if not `id=(.*)`)

problem how to make .htaccess to remove question mark fro ...

重写所有的虚拟子域使用htaccess的同一个文件夹(Rewrite all virtual subdomains to same folder using htaccess)

problem i have been searching the internet trying to find ...

扩展名的URL斜杠重定向(Extensionless URL trailing slash redirect)

problem i've tested the code below on several domains hos ...

绑定域名重定向到子文件夹(Parked domain redirect to subfolder)

problem i have 2 domain: maindomain.com parkeddomain.co ...

子域的基础上codeIgniter控制器名称(Subdomain based on CodeIgniter controller name)

problem suppose i have this two different mod ...

移动codeigniter项目到Amazon EC2,htaccess以及ModRewrite问题(Moving Codeigniter Project to Amazon EC2, htaccess and ModRewrite Problems)

problem i am attempting to move my codeigniter projects f ...

htaccess的不工作的GoDaddy的(htaccess not working on godaddy)

problem i recently moved to godaddy and the . ...

堵semalt引荐与htaccess的规则(blocking semalt referrers with htaccess rules)

problem i have implemented the following code to htaccess ...

获取与htaccess的网址两个变量(Getting two variables in the URL with htaccess)

problem what way it is to be to get two get methods in th ...

排除来自重写规则的文件夹/目录(Exclude a folder/directory from RewriteRule)

problem i have a pretty standard wordpress .htaccess with ...

如何只允许在国家访问(How to allow access only within country)

problem i found this web site to generate a .htaccess to ...

在什么条件下会在浏览器缓存视频文件?(Under what conditions will the browser cache <video> files)

problem under what conditions will the browse ...

如何调试mod_rewrite规则?(How can I debug mod_rewrite rules)

problem this is a case of "ask a question and answer it m ...

自定义404错误页面 - 只为PHP页面(Custom 404 error page -- for PHP pages only)

problem i have a personalized page for 404 with htaccess ...