#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2011
    Posts
    3
    Rep Power
    0

    Website directory related i.e. www.website.com/directories... Help


    Hi all

    This is my first post and I hope you guys can help me.

    Is there a way to have a directory without the folder being in the root of the website.

    i.e. if I have a website and I wanted for example:

    website.com/directoy1

    Is there a way to accomplish this without a folder called "directory1" in the root of the server?


    I hope that makes sense
  2. #2
  3. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,959
    Rep Power
    9397
    Yes. Options include aliases/virtual directories and URL rewriting, depending.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2011
    Posts
    3
    Rep Power
    0
    Originally Posted by requinix
    Yes. Options include aliases/virtual directories and URL rewriting, depending.
    Thanks requinix.

    I found this tutorial. Is this a good method?

    Youtube: http://www.youtube.com/watch?v=CrK5_SX87AU

    If I was to have say hunderds of folders?
    Last edited by Kravvitz; November 14th, 2011 at 04:57 PM. Reason: made the URL easier to copy and paste
  6. #4
  7. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,959
    Rep Power
    9397
    No, it is not. For one, Redirect doesn't do what you need it to do. Second, it wouldn't be good for dealing with many locations.

    URL rewriting is the way to go. What are these /directory1 paths for?
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2011
    Posts
    3
    Rep Power
    0
    Basically I noticed facebook users have their names after the domain. i.e. facebook.com/name and surely they don't have millions of folders in the root of their website.

    I was asked to design a Africa charity directory website in which I wanted to give the site an option to enter a city after the url. i.e.

    website.com/southafrica

    or

    website.com/egypt

    and I don't want to put all the countries and cities in the root of the website.

    I'd rather keep it in root/africa/

    But whenever a country or city is entered after the domain, it directs to the appropriate directory.
  10. #6
  11. Code Monkey V. 0.9
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Mar 2005
    Location
    A Land Down Under
    Posts
    2,094
    Rep Power
    1990
    I think you're getting your terminology and functionality mixed up a bit. But it can be a bit confusing.

    What requinix is trying to suggest (which is the best way to do it) is to use server re-writing to mask the folder names.

    This will take a URL like (this is what your users will see):

    http://yoursite.com/folder1

    And re-write the URL when it hits the server to go to something like (this is what the server will see and use):

    http://yoursite.com/yourpage.php?folder=folder1

    This will work the same for any folder. Any first-level folder will map to yourpage.php?folder=*FOLDER NAME* so you know what to put on that page.

    So, you don't have hundreds of folders around the site, and you don't need to have anything special done. On *nix servers, it's mod-rewrite using the Apache .htaccess file. On Windows it's set up in IIS (I don't know Windows much so I can't comment on how it's done there).

IMN logo majestic logo threadwatch logo seochat tools logo