Configure apache php server to point location another then htdocs or www

Standard

Obviously! we can point apache server to pick our code files from another location other then www or htdocs. Also we can configure the url for our project folder.

Lets take a look how.

Step 1. Look for the file httpd.conf (this can be found under your apache installation folder inside conf directory)

Step 2. Open httpd.conf with your favorite editor.

Step 3. Look for the line

DocumentRoot "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs">

Step 4. After this tag insert your own Document and Directory.

DocumentRoot "E:/work/myproject"
<Directory "E:/work/myproject">
 Options Indexes FollowSymLinks Includes ExecCGI
 AllowOverride All
 Require all granted
</Directory>

Step 5. Look for another line

<IfModule alias_module>

Step 6.

Insert your own alias after closing the above tag.

<IfModule alias_module>
    Alias /myproject E:/work/myproject
</IfModule>

Where Alias has two parameter 1. one is your url after localhost 2. your project folder path.

Result :

You can access your E:/work/myproject project at URL http://localhost/myproject

 

Let me know your feedback guys!!!

 

Cheers!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s