November 14th, 2011, 03:48 PM
Website directory related i.e. www.website.com/directories... Help
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:
Is there a way to accomplish this without a folder called "directory1" in the root of the server?
I hope that makes sense
November 14th, 2011, 04:27 PM
Yes. Options include aliases/virtual directories and URL rewriting, depending.
November 14th, 2011, 05:00 PM
Originally Posted by requinix
I found this tutorial. Is this a good method?
If I was to have say hunderds of folders?
Last edited by Kravvitz; November 14th, 2011 at 05:57 PM.
Reason: made the URL easier to copy and paste
November 14th, 2011, 07:12 PM
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?
November 14th, 2011, 10:58 PM
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.
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.
November 15th, 2011, 12:02 AM
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):
And re-write the URL when it hits the server to go to something like (this is what the server will see and use):
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).