【问题标题】:Problems uploading my website (root directory)上传我的网站(根目录)时出现问题
【发布时间】:2017-04-12 20:03:22
【问题描述】:

本地主机中的编码世界是如此美丽,但是当移动到真正的主机时,它会变得很痛苦......

我的问题是,出于安全原因,我想将一些文件保留在根目录之外,所以它看起来(实际上在我的 localhost 中是这样的):

/
|---public_html
|       |------ index.php
|---Includes
          | -- importantstuff.php

由于某种原因,我无法访问 public_html 中的任何文件,所以我想将结构更改为:

/
|---public_html
             |-----------root
             |--Includes    |------ index.php
                    | -- importantstuff.php

所以现在我的新问题是将根目录更改为“根”文件夹。

我已经阅读了很多替代方案,但其中任何一个都对我有用,例如将 .htaccess 更改为:

DirectoryIndex root/index.php

或者

RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteCond %{REQUEST_URI} !root/
RewriteRule (.*) /root/$1 [L]

但是第一个在页面之间移动时一切都会变得疯狂并得到很多 404 Not Found 而第二个仍然无法正常工作......有什么想法或明确的手册之类的吗?对我来说,如果我首先想到的(在 public_html 之外)或新的(替代根文件夹)解决了这个问题,只要它开始工作......

提前谢谢你。

何塞·拉拉。

PS:我的主机是 Hostinger,如果这有帮助的话......

【问题讨论】:

    标签: php .htaccess root host


    【解决方案1】:

    也许“.htaccess”文件开头的这一行会解决:

    RewriteBase root/
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-31
      • 1970-01-01
      • 1970-01-01
      • 2012-07-31
      相关资源
      最近更新 更多