Welcome to WebmasterWorld Guest from 54.226.133.245

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Setting up an alias for DocumentRoot

     
12:47 am on Jan 12, 2011 (gmt 0)

Preferred Member

10+ Year Member

joined:Oct 7, 2003
posts: 539
votes: 0


I have a site that has been moved from one server to another. The directory structure on the new server is different, and rather than change hundreds of files I would like to try to set up an alias for DocumentRoot.

The path contained in my files is:
/home/httpd/vhosts/domain.com/httpdocs/

The DocumentRoot in the vhost.conf on my server is:
DocumentRoot /srv/www/domain.com/public_html/

Is there a way to alias /home/httpd/vhosts/domain.com/httpdocs/ to /srv/www/domain.com/public_html/?

I have tried the Alias directive, but it didn't work, perhps I had the syntax wrong.
8:03 am on Jan 12, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


Why not just change the DocumentRoot directive in the configuration so that it points to the right place?

What do you mean by "hundreds of files"? Have you "included" files and used the full path in the reference? An editor such as EditPlus3 could do a find and replace on all of your files in minutes. However, the server path for PHP includes (if that is what it is) should have been defined in a variable or set as a configuration line in the config file or in .htaccess.
12:01 pm on Jan 12, 2011 (gmt 0)

Preferred Member

10+ Year Member

joined:Oct 7, 2003
posts: 539
votes: 0


The changing of httpdocs to public_html I'm not concerned about, it's the /srv/www part that I thought may cause problems.

I know I could change via find-and-replace. But this is a temporary server and I don't want to maintain two sets of files.
7:44 pm on Jan 12, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


Replace the fixed path with a variable and define it once in one place.
12:23 am on Jan 13, 2011 (gmt 0)

Preferred Member

10+ Year Member

joined:Oct 7, 2003
posts: 539
votes: 0


There are several installed apps that I am unable to change (path is hard coded in after installation). That is why I am in need of a DocumentRoot alias in vhost.conf or httpd.conf.
5:42 pm on Jan 14, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


You may also want to look into using symlinks (symbolic links) at the server OS level.

Jim