SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot JarretCade's Avatar
    Join Date
    Aug 2007
    Location
    California
    Posts
    161
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Define Root Folder With htaccess?

    I did some searching for this on the forums but couldn't find an exact situation.

    I basically have my own test server using WAMP. I have a few different folders for testing things...

    /test1
    /test2
    /test3

    And inside of those folders they would have subdirectories as well. What I'm wanting to do is basically be able to define each test1, test2, test3 folders as the root folders. So that I can transfer the site straight from my test server to the live site without having to modify links when moving it over.

    As an example...


    /test1/subfolder1
    /test1/subfolder1/subfolder1-2

    /test2/subfolder2

    And have each of the subfolders use the test folder as their root directory. Hopefully I explained this well enough that somebody understands what I'm trying to do. If not let me know and I'll explain further.
    Web Hosting Comparison - WebHostsDeals.com - Leave your review!

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Create a VirtualHost for each of your sites. Give each VirtualHost its own DocumentRoot. Do this in your httpd.conf file.

    For example, if your site is http://www.example.com, then create a VirtualHost for http://example with its own DocumentRoot. You can add an entry to your hosts file so that "example" resolves to your own computer.

    Then everything will be the same locally as on the live site, and you won't have to change any links.

  3. #3
    SitePoint Member
    Join Date
    Sep 2009
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's a great trick that can solve a lot when developing a new site. thx.

  4. #4
    SitePoint Zealot JarretCade's Avatar
    Join Date
    Aug 2007
    Location
    California
    Posts
    161
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Woot! Thanks Dan, haven't tried it out yet but I'm sure it'll work perfectly...thanks!
    Web Hosting Comparison - WebHostsDeals.com - Leave your review!

  5. #5
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,692
    Mentioned
    20 Post(s)
    Tagged
    3 Thread(s)
    Thanks, Dan!

    JC & tm, the current file is httpd-vhosts, though, and you do need to add the VirtualHost domains in your hosts file (127.0.0.1).

    Regard,s

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •