I have an Alias for a directory
Alias /out /myData/all
<Directory /myData/all >
Options Indexes MultiViews
AllowOverride None
Order deny,allow
Allow from all
</Directory>
myData/all has many subdirectories of different projects. When someone accesses host/out/project01 through a direct link, I would like to restrict their ability to to click Parent Directory and see all project folders under out. Is this possible with the alias?
If you're talking about something like:
http://example.com/out/project01/..
^^--- "up a level" link
then the actual requested page would be
http://example.com/out/
which is aliased to the /myData/all directory. Since that directory has indexes enabled (Options Indexes) they could browse all the projects.
Either turn off indexes, or move your aliases down a level:
Alias /out /myData/all/project01
so that moving up a level:
http://example.com/out/..
simply takes you to
http://example.com/
Related
I have Windows version of XAMPP installed in C:\xampp.
All works well, however I am building a Netflix clone and all of my material (Shows/Movies/etc) are located in external HDDs (e.g.: E:\ and F:\).
Is there a way to keep site in C:\ while having access to E:\ and F:\ ? Basically all I need is to provide video src full path to E:\movie.mkv or F:\movie.mkv but when I do it now - blank screen is shown.
I am only aware of solution where I could merge two HDDs into one (Dynamic HDD) which would then share same drive letter and change DocumentRoot to that letter. I would like to avoid such setup however.
If you have something "streaming" the file to the enduser, there's no problem: your php,jsp or whatever you're using just need to have access to the file, regardless where it is, reand and stream it.
If you're just planning to show the content of the folder itself, you can create an Alias to each root folder. You can refer to the official documentation for the details: https://httpd.apache.org/docs/2.4/mod/mod_alias.html
Thanks for setting me on the right path (no pun intended). For those who need the answer:
httpd.conf:
Alias /disk1 "E:"
<Directory "E:">
Options Indexes FollowSymLinks MultiViews
Require all granted
</Directory>
Alias /disk2 "F:"
<Directory "F:">
Options Indexes FollowSymLinks MultiViews
Require all granted
</Directory>
Hi I have several domains that would like to access the same image repository. Is there an easy way of doing this? I am running plesk on linux.
I have found this page https://httpd.apache.org/docs/2.4/mod/core.html#directory. with this syntax to be put in the additional directives for http and https sections in the server settings.
will this
<Directory "/usr/local/httpd/htdocs">
Options Indexes FollowSymLinks
</Directory>
allow me to read and write to those directories?
FollowSymLinks option will allow exactly it - Apache will be able to process data which is not physically located inside domain directory, but is referred to by a symlink located inside domain directory.
There are two major points that you should be aware of:
1. You should have sufficient permission for system users of the domain which will be accessing shared files on the directory which contain these files. Basically, chmod 666 will do the job, but it is up to you how exactly set up rights to maintain desirable security level.
2. If websites are using PHP code, you should ensure that shared directory is included in open_basedir value.
This link can be useful - How to change open_basedir parameter for all domains?
How can I show file names in the directory listing on apache server.
I am using
Options +Indexes
I have also tried
Options Indexes FollowSymLinks
in the root but I am not able to see file names only an empty structure
There are 4-5 files of different names and extension available in the folder.
If you're unable to generate auto index even after dabbling with file permissions; it is generally all thanks to IndexIgnore directive.
Check your server settings, going one step above from the current htaccess at a time. See where you encounter it.
I currently have my WAMP installation at:
C:/wamp/www/
My issue:
When calling $_SERVER['DOCUMENT_ROOT']; from localhost/projectname1/test.php - this outputs:
C:/wamp/www/
This is no good since path in my scripts will be wrong then. I this case I want Document root to output (which is my alias path for this dummy project):
C:\Users\SGS\Google Drive\_Work\projectname1\html/
All my working files are on google drive, so for each project I create an Apache alias, that points to the direct path of the project located on google drive folder.
Example of an alias created - projectname1.conf:
Alias /projectname1/ "C:\Users\SGS\Google Drive\_Work\projectname1\html/"
<Directory "C:\Users\SGS\Google Drive\_Work\projectname1\html/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
Allow from all
</Directory>
This allow me to call the project with localhost/projectname1/
How do I get my document?
I think you would be better creating a Virtual host for each of your projects.
HowTo setup Virtual Hosts
The problem with SCRIPT_NAME is that it is not static because it is based on the name of current executing script. Before Apache 2.3.x becomes popularly adopted so that we can use CONTEXT_PREFIX variable, I'm afraid there's no solution.
I have user files stored in a folder outside apache's documents root e.g. My project is in /var/www/ProjectName/ and the files are in local drive(D:\users).
I want to be able to link to those files from within my project. i am using symfony(php framework).
I trying to change the setting in apache like this, But no luck
Alias /users/ "D:\users"
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
You have to update that in your httpd.conf or in your specified {name of your vhost}.conf.
Alias /users/ D:\users
Be sure to check the error log to see where here Apache tries to find the files.