I want to be able to use aliases outside the c:\xampp-scope, as in
alias /opt "C:\opt"
there's some setting in xampp I can't pin down, tried changing user, added etc, of which none works, it's a pure dev-environment, so what's the most kiss-solution here?
regards, //t
Once you've opened httpd. conf, add the following to the end and save it. Now Apache will look in the alias folder for more configuration files. This way you can add an alias by simply adding a new configuration file to the conf/alias/ folder.
The main XAMPP configuration files are located as follows: Apache configuration file: \xampp\apache\conf\httpd. conf, \xampp\apache\conf\extra\httpd-xampp.
You need to have two entries for it, an alias and a directory. You should have an entry in your /opt/lampp/etc/extra/httpd-xampp.conf (source) that looks like one of the following code blocks. Some configuration options have changed, more information can be found in the document Upgrading to 2.4 from 2.2
Apache 2.2 Config:
Alias /opt/ "C:/opt/"
<Directory "C:/opt">
Options Indexes FollowSymLinks MultiViews ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Apache 2.4 Config:
Alias /opt/ "C:/opt/"
<Directory "C:/opt">
Options Indexes FollowSymLinks MultiViews ExecCGI
AllowOverride All
Require all granted
</Directory>
The Alias section defines where your virtual directory and real directory are located. In this example website.com/opt/ (or localhost/opt) would point to C:/opt on your hard drive.
The Directory part definates how apache should handle content served from this location, it would function like any other Directory entry, so it might be a good idea to just copy the one from your root entry and make them similar.
This will also require mod_alias to be enabled, check in your httpd-xampp.conf and make sure that the entry for it is not commented out. After any changes to your conf file you will need to restart apache for the changes to be made active.
The first thing you’ll want to do is add an alias directory to your XAMPP install:
C:\xampp\apache\conf\alias
Next, you’ll need to change your Apache configuration file. You can find it under
C:\xampp\apache\conf\httpd.conf
Once you’ve opened httpd.conf, add the following to the end and save it.
Include "conf/alias/*"
Now, for each alias you want to create you need to create one file like this:
<directory "c:\users\foo\programming\dev">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks Includes ExecCGI
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
# Order allow,deny
Allow from all
</Directory>
Alias /dev "C:\users\foo\programming\dev"
In this example the alias is called "dev" and it point to "C:\users\foo\programming\dev"
Finally, you need to restart your Apache Server and that's it.
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