|
-
Sep 16th, 2011, 10:12 AM
#1
Thread Starter
Fanatic Member
Folders on Server? How do they do this?
Sorry, bit off topic but this is something I have never understood ... I have developed a lot of database driven web sites over the last 14 years or so - and, if I develop, for example, a web site to show properties and someone clicks on a property - the page address might look like ... www.propertysite.com/Propertydetails.aspx?PropertyID=168 ... and I'll fetch details of whatever property is wanted and show it on one page.
Then I look at the properties of a site like this (to see what it is developed in - i.e. what the page file suffix is)
http://www.realtor.com/realestateand...9_M45605-41980
and I think 'how do they do that? I mean, they can't create a folder for every property can they?
What mechanism is at work here?
Last edited by Webskater; Sep 16th, 2011 at 10:15 AM.
-
Sep 16th, 2011, 11:04 AM
#2
Re: Folders on Server? How do they do this?
it's known as url rewriting (or modrewrite)... and requires a change to you htaccess file...
basically, you give it pre-processing instructions that tell it, OK, when you see this....blah blah blah... re-write it and pass it to index (or what ever server side file) with this querystring...
so, in your case, you could set up the options so that
www.propertysite.com/Properties/168 results in a rewrite of http://www.propertysite.com/Property...PropertyID=168
I'd give a more exact example of what to put in the htaccess file, but this is an area of weakness of mine... I know the concept, I can copy & paste & butcher examples, but I don't know how to make them up from scratch...
-tg
-
Sep 16th, 2011, 11:07 AM
#3
Thread Starter
Fanatic Member
Re: Folders on Server? How do they do this?
Thanks for that - is the idea to make the querystring a bit less hackable?
-
Sep 16th, 2011, 01:54 PM
#4
Re: Folders on Server? How do they do this?
nope... not really... it's to provide a more friendly url... it also has to do with making the site SEO (search engine order) friendly... search engines have trouble indexing querystrings... they can happen in any order... while a seo-friendly url has a specific structure to it...
example:
index.php?id=123&cat=7&theme=4
index.php?cat=7&id=123&theme=4
index.php?theme=4&id=123&cat=7
all basically point to the same thing... SE's can't index that well... BUT... something like this:
given, Theme 4 = Clean; Cat 7 = Published
/Clean/Published/123 will point to the same thing... while this
/Published/Clean/123 will cause a 404 error because the mod rewrite rules dictate that the first "folder" is the Theme setting, the second is the Category, and the final element is the ID if the item (or what ever).
Blogs use this format a lot:
category/year/month/day/title (commonly known as the post slug) ....
TechStuff/2011/09/16/how_to_make_thing_seo_friendly
in fact here's a real-live url from my blog:
http://techgnome.wordpress.com/2011/...dangerous-seo/
I can tell just by looking at it that the title is "Dangerous SEO" and that it was posted on May 31, 2011.
-tg
-
Sep 17th, 2011, 05:24 AM
#5
Thread Starter
Fanatic Member
Re: Folders on Server? How do they do this?
Thanks again ... I guess it doesn't really apply to the stuff I do. Referring to the example I posted, which is a real-life address (the realtor.com one) ... don't search engines crawl your site indexing the urls of the pages found? ... and, if this is true, how does the search engine crawl what appears to be a folder address? Are they creating a separate file for every property they have in the database?
If they add a new property to their site (to their database) whose address is '25 Acacia Avenue' they have to go to the trouble of setting up a url rewrite (for every property)? Or is this done automatically somehow?
-
Sep 19th, 2011, 02:39 PM
#6
Re: Folders on Server? How do they do this?
Hello,
With the advent of ASP.Net 4.0 the concept of routing (which came over from ASP.Net MVC) was made available, so this is another approach that you could use:
http://msdn.microsoft.com/en-us/library/cc668201.aspx
Gary
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|