Welcome to WebmasterWorld Guest from 54.167.5.15

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Setting up an alias for DocumentRoot

     

JohnKelly

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

10+ Year Member



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.

g1smd

8:03 am on Jan 12, 2011 (gmt 0)

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



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.

JohnKelly

12:01 pm on Jan 12, 2011 (gmt 0)

10+ Year Member



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.

g1smd

7:44 pm on Jan 12, 2011 (gmt 0)

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



Replace the fixed path with a variable and define it once in one place.

JohnKelly

12:23 am on Jan 13, 2011 (gmt 0)

10+ Year Member



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.

jdMorgan

5:42 pm on Jan 14, 2011 (gmt 0)

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



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

Jim
 

Featured Threads

Hot Threads This Week

Hot Threads This Month