I am uploading my project containing folders with all the scripts, PHP, CSS etc, and the index.html
Let's say the URL looks like this www.mydomain.com/project/web/index.html
Inside the parent folder "project", all my files are visible and easily accessible to download (which they shouldn't) if they simply enter www.mydomain.com/project/
Question: Is there any way to HIDE all the parent folders and documents and only make my /index.html accessible?
My server is not an Apache so I can not setup an .htaccess file and build rules to hide/redirect and return a 404 Error page.
Refers to the directory above another directory. Every directory, except the root directory, lies beneath another directory. The higher directory is called the parent directory, and the lower directory is called a subdirectory.
You could set up a index.html
in your projects folder or any other folder that you don't want them to have access.
Then in those index.html
pages you can add redirects to push the user to your true homepage. You would place this code in the head of that index.html
<meta http-equiv="refresh" content="1; url=www.mydomain.com/project/web/">
<script type="text/javascript">
window.location.href = "www.mydomain.com/project/web/"
</script>
I still think the best way is to use a .htaccess
. But if you have no other choice this will work for folder based access.
This would not prevent people from accessing the file directly such as www.mydomain.com/project/file.txt
Actually, your server is Apache.
This is from their documentation:
What is the difference between the old and new webservers? The operating system on all new webservers are running Debian 8 Jessie, up from Debian 7 Wheezy.
Apache is upgraded from Apache 2.2 to Apache 2.4. If you are running your own .htaccess-file (especially accesscontrol) on your webhotel, this may need to be upgraded. Check Apache-documentation for more information.
We are now using uWSGI to run PHP, instead of suPHP (mod_suphp).
Link to documentation: FAQ
Link to rewrite_mod for Apache 2.4 Apache 2.4
You can try my idea.
index.html
or index.php
file inside of a folder you dont want the user to access, for example, the project
folder; so when a user attempts to visit www.mydomain.com/project
and see the content, the index.html
will be showed instead. OR redirect
the user to index.html
using php
or JavaScript
.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With