Help with understanding .htaccess

Discussion in 'Apache' started by Grimbone, Jun 3, 2006.

  1. #1
    Ok, first let me say im am very new to .htaccess. I have researched it a bit on the web and that is the extent of my knowledge with .htaccess. With that out of the way im trying to create an .htaccess to redirect my website to a folder. Here is a bit more details.

    I have setup my DNS manager for the host to point to my IP. In the DNS manager @ points to my ip address. This ip goes to the root directory on my server. Problem is my website resides in a folder in the root directory called /gamerquest.

    What i need is for when someone types www.gamerquest.net instead of it looking in the root directory for index.php it looks in /gamerquest/index.php. This is where i think .htaccess comes into play but again im very new at .htaccess.

    Any help with this would be greatly appreciated!
     
    Grimbone, Jun 3, 2006 IP
  2. Grimbone

    Grimbone Peon

    Messages:
    13
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Can anyone help me out on this?
     
    Grimbone, Jun 15, 2006 IP
  3. Daniel

    Daniel Peon

    Messages:
    1,453
    Likes Received:
    70
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hey Grimbone,

    You dont need to use .htaccess. What you need is to setup an ip based virtualhost in apache config file.

    you will need to edit /usr/local/apache2/conf/httpd.conf if you are running apache version 2 or /usr/local/apache/conf/httpd.conf if you are running apache version 1

    If you are running an apache server that was installed with a linux distro like redhat or fedora core you will need to look for the httpd config file in /etc/httpd/httpd.conf

    none the less what you need to di in the config file is go to the end of it and put a new virtualhost block describing what folder you want the web server to direct the resquests for your domain to.

    here is an example of an ip based virtualhost config block that i pulled off of google for you.

    Server configuration
    Listen 80

    <VirtualHost 172.20.30.40>

    DocumentRoot /www/example1
    ServerName www.example1.com

    </VirtualHost>

    <VirtualHost 172.20.30.50>

    DocumentRoot /www/example2
    ServerName www.example2.org

    </VirtualHost>


    Here is the link I got the info for you from. Let me know if you need futhur help :)

    http://httpd.apache.org/docs/2.0/vhosts/examples.html
     
    Daniel, Jun 19, 2006 IP
    Grimbone likes this.
  4. Grimbone

    Grimbone Peon

    Messages:
    13
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks for the help. I was able to configure the server to use VirtualHost and all is working perfect. I was wondering why i could not figure this out and i was looking in the wrong place using htaccess.

    Thanks again for pointing me in the right direction!
     
    Grimbone, Jul 16, 2006 IP
  5. Daniel

    Daniel Peon

    Messages:
    1,453
    Likes Received:
    70
    Best Answers:
    0
    Trophy Points:
    0
    #5
    No problem man :)
     
    Daniel, Aug 19, 2006 IP