Page 1 of 1

How to change the root of my site

PostPosted: 09. December 2007 22:05
by Goofy2k
I have a site up and running under XAMPP.

The site's root is in a folder, which is in the XAMPP/htdocs folder.

Is there a way to redirect users to the root of my site, without having to change the location of my site.

I read about the document_root variable. Can I change that variable? And where can I do that?

thank you
Goofy2k

PostPosted: 10. December 2007 00:58
by KallistaAEnvarou
In your httpd.conf file, look for the word DocumentRoot. Change the line from

DocumentRoot "C:/xampp/htdocs" [example]

to

DocumentRoot "C:/xampp/htdocs/website" [example].

If you need to do something like this for multiple folders, you'll need VirtualHosting. See my topic .htaccess and links on localhost (Sufficiently Resolved) for more info if you need to update the DocumentRoot information for more than one website folder.

PostPosted: 10. December 2007 06:06
by Izzy
The previous poster was only partially correct and would have instigated an error.

http://wiki.apache.org/httpd/MovingDefaultDocRoot

If you want to change your default DocumentRoot path, there are at least two things you need to update.

1. The DocumentRoot directive
2. The <Directory> block associated with the DocRoot.

As each DocumentRoot needs a matching <Directory> block, be sure to update both to reflect the new location.

If you only change the DocumentRoot path, you will get a 403 Forbidden error in your browser.



===========================================
1. The new DeskTopXampp Launch Control for XAMPP / XAMPPlite
Posted by Ridgewood available from Ridgewood'sDTX web site

2. Build Rich AJAX Applications - Faster
TIBCO General Interface Pro Edition but FREE and Open Source
Fully working with NO donations required to get a user/password
===========================================

PostPosted: 10. December 2007 23:10
by Goofy2k
Great guys :D

This works !

I now have my Drupal 5.5 site running under Apache.


Goofy2k

PostPosted: 10. December 2007 23:17
by Goofy2k
So, it works. I changed /htdocs to /htdocs/newroot

But now I am curious:


When I now enter http//:mysite/htdocs in my browser, I would expect to see the old pages again. But I get the pages under

/htdocs/newroot

Why is this?

Goofy2k

PostPosted: 10. December 2007 23:39
by Izzy
Because now your new DocumentRoot is xampp/htdocs/newroot and anything out of this directory will not be allowed to be served.

The only way to get that old directory to be seen is to move xampp/htdocs/xampp into your new DocumentRoot xampp/htdocs/newroot/xampp- this is a server security issue as it prevents someone being able to access any directory other than from within the DocumentRoot.
http://localhost/xampp will then be the address for these old files.
http://localhost/ will give you your Drupal script

You may also have to run xampp\setup_xampp.bat file to have the new paths to the xampp directory location recognized.

BTW it is not a good idea to change the DocumentRoot for the purpose you have mentioned as it only causes confusion, as you have found out.

The easiest and preferred way would have been to delete the xampp/htdocs/index.php from the xampp/htdocs directory and place all your Drupal files in the xampp/htdocs directory and proceed to install Drupal.
Then you would have had the same result without moving anything.
http://localhost/ - would have served Drupal
http://localhost/xampp/ - would have severed the XAMPP Welcome Page.

It's still not to late to put everything back to the defaults and follow the above instructions - you may have some unexpected adverse situations raise their ugly head in the future doing it the way you did.



===========================================
1. The new DeskTopXampp Launch Control for XAMPP / XAMPPlite
Posted by Ridgewood available from Ridgewood'sDTX web site

2. Build Rich AJAX Applications - Faster
TIBCO General Interface Pro Edition but FREE and Open Source
Fully working with NO donations required to get a user/password
===========================================

PostPosted: 11. December 2007 20:47
by Goofy2k
Thanks again.

This is of great help. As I am just starting to experiment, I believe this is the right time to do the things in the right order. I am faced with both XAMPP and Drupal being new for me.