Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Redirect to home folder 1

Status
Not open for further replies.

qwicker

Programmer
Feb 16, 2005
12
0
0
US
Hi, this is probobly simple, but i want to set the home folder of my domain name to somehting other than the root. For example, i have I want the default folder to be instead of it just going to the default directory. I tried to redirect, but i creat an infinite loop. Thanks in advance
 
I may be missing your point, if so I apologise, but it sounds like you are referring to virtual hosting.

There is a section near the end of the httpd.conf file that sets this up. You need to make sure the
NameVirtualHost *:80
line is not commented out and add a VirtualHost section similar to the ones below.

Then restart Apache.

The visitor is directed to the directory named in the "DocumentRoot" line.

----
# File httpd.conf
# Use name-based virtual hosting.
#
NameVirtualHost *:80

# This entry is used when I address the server directly from within my LAN so the refering address is the servers IP address that I type into the address bar
<VirtualHost *:80 >
ServerName 178.0.0.123
DocumentRoot "/ </VirtualHost>

# This entry is used when visitors enter " into the explorer address bar.
<VirtualHost *:80 >
ServerName DocumentRoot "/ </VirtualHost>


Hope this helps
Les....
 
You can change the DocumentRoot to any directory on your hard drive.

 
How do i do that....sorry for being a noob. With .htaccess??
 
You will find the 'DocumentRoot' directive in the httpd.conf file. If you have only 1 host it will only be listed once. If you have multiple virtual hosts (as bonifale posted), there will 1 for each and they can each be different. Modify these lines of httpd.conf as you wish, then restart apache.
 
Hmmm I'm not sure if i have access to that. Let me explain my server setup. I am using a shared hosting account, thus i do not have direct access to the server. I use C-panel. I have an add-on domain name that is pointed to a folder in the main directory. I want to make the home directory one of the sub directories. For example my add-on domain is My website is actually located at What I want is to have automatically load senatorgavin.com/gallery/gallery. I do not seem to be able to use a redirect because it creates an infinite loop. And with a shared hosting account, i cannot access httpd.cong (I think; i couldnt find it anywhere)
 
I don't understand what you want to do. When I click on both links, they take me to the same place. Isn't that what you want. As for httpd.conf, if you have a hosted account, you do not have access to this file. There isn't much you can do to move your domain to another directory because that is how accounts get add-on domains get setup for c-panel users. I'm not sure if mod_rewrite can be used within .htaccess but you can check it out at
 
Hi

qwicker said:
I do not seem to be able to use a redirect because it creates an infinite loop.
When experience such problems with [tt]Redirect[/tt] directive, try [tt]RedirectMatch[/tt]. Put this in a .htaccess file in your document root directory :
Code:
RedirectMatch ^/$ [URL unfurl="true"]http://www.senatorgavin.com/gallery/gallery/[/URL]
Of course, if the hosting company's policy is to user [tt]AllowOverride none[/tt], this is useless.

Feherke.
 
YEs, that worked feherke. Thanks so much for bearing with my noobness
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top