简体   繁体   中英

Problems uploading my website (root directory)

The coding world is so beautiful in the localhost, but when moving to a real host it is coming a pain in the ass...

My issue is that for security reasons, I want to keep some files outside of the root, so it would look (actually it is like this in my localhost) like:

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

For some reason, I am not able to access to any file out public_html, so I have though about changing the structure to something like:

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

So now my new problem is about changing the root to "root" folder.

I have read so many alternatives but any of them are working for me, like change the .htaccess for:

DirectoryIndex root/index.php

Or

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

But with the first one everything gets crazy when moving between pages and get a lot of 404 Not Found and with the second one is still not working... Any idea or clear manual or something? For me it is okay if this is solved as I had first on my mind (outside of the public_html) or the new one (alternative root folder), as far that it begins to work...

Thank you in advance.

Jose Lara.

PS: My hosting is Hostinger, if this is helpful...

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

RewriteBase root/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM