Creating Alias Directory for Apache in Windows

Well Ollllo there!!!!

So you have started creating your own project and i guess you’re wondering how to shortcut your project.

(For those who wonders “what is ‘aliasing’ directory”?)

To be short,

let say you have created a project “E:\Program Files\xampp\htdocs\blah\\trunk\myproject\app\”,

so… what do you do to load up in browser “http://localhost/blah/trunk/myproject/”. You might not feel it in the beginning, but as start to become curious (and lazy or wanna be quick), you could do like “http://localhost/myproject”

Ofcourse, you could just put your project directly in htdocs which might makes thing simple, buut… as we create more and more projects, we need to organize or need to use SVN or GIT, and need to follow their folder structure, so, you NEED to shorting things first. Not only it saves time… its cool! 😀

(Lets get started…. )

The example i’m gonna show below is for CakePHP.

1) Find httpd.conf file (must be somewhere here <E:\Program Files\xampp\apache\conf\httpd.conf> or whereever you have installed APACHE)

Find this line,

and change to,

(just removed the comment, i.e ‘#’)

2) Add a new file say, ‘myconfig.conf’ in <E:\Program Files\xampp\apache\conf\proj\myconfig.conf>

(lets keep the config seperate, so you can modify easily)

3) Add the below lines in ‘myconfig.conf’

4) Now, in httpd.conf, add the below line

5) Thats it, restart apache and hit <http://localhost/myproj>, it works!!!! but.. its not over it

6) (This is the step which got my nerve) You see the links (any link on those myproj) looks in unshorten form

Open, <E:/Program Files/xampp/htdocs/blah/trunk/myproj/app/webroot/.htaccess>, it should be like below

Thats all!!! 🙂

For reference, check it out:

http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritebase

If you’re stuck with mod-rewrite, check: http://www.lancelhoff.com/enabling-htaccess-in-apache-on-windows/

Checkout more about Sublime Text2 here!

Leave a Reply