Alias 403 Forbidden With Apache
Learn Alias 403 Forbidden With Apache
Published
I was trying to run php files from my USB drive other then htdocs folder. As it was on local machine and I was not concerned about security issue. So, I used the following code to run php files from USB drive.
You need to add following code into httpd-vhosts.conf file that normaly located inside apache folder under xampp installed directory.
like it’s available on following path of my machine d:\xampp\apache\conf\extra You can check your installed directory.
In the alias I provided my USB address and use the same address in <Directory “address” >.
Note: By defining alias you can access the particular directory using localhost. So, I can use localhost/resources in webbrowser to access “F:/git/resources”
#FileName: httpd-vhosts.conf
Alias /resources "F:/git/resources"
<Directory "F:/git/resources">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
Explanation
The Options directive controls which server features are available in a particular directory.
option can be set to None, in which case none of the extra features are enabled, or one or more of the following:
-
All: All options except for MultiViews.
-
ExecCGI: Execution of CGI scripts using mod_cgi is permitted.
-
FollowSymLinks: The server will follow symbolic links in this directory. This is the default setting.
-
Includes: Server-side includes provided by mod_include are permitted.
-
IncludesNOEXEC: Server-side includes are permitted, but the #exec cmd and #exec cgi are disabled. It is still possible to #include virtual CGI scripts from ScriptAliased directories.
-
Indexes: If a URL which maps to a directory is requested and there is no DirectoryIndex (e.g., index.html) in that directory, then mod_autoindex will return a formatted listing of the directory.
-
MultiViews: Content negotiated “MultiViews” are allowed using mod_negotiation.
Please see httpd.apache.org
AllowOverride controls what directives may be placed in .htaccess files. It can be “All”, “None”, or any combination of the keywords.
Require all granted Controls who can get stuff from this server.