Solutionabc
asked on
Site archetecture question
Hi,
I am curious as to how to dynamically create pages. I see websites like facebook and youtube have pages for each of their users..... like:
facebook/me
OR
youtube.com/user/me
Would they be creating actual pages for each user or would they have one page that calls the users profile from the db?
If they are using the one page method how is google able to index this type of thing if it doesn't physically exist.
thanks!
I am curious as to how to dynamically create pages. I see websites like facebook and youtube have pages for each of their users..... like:
facebook/me
OR
youtube.com/user/me
Would they be creating actual pages for each user or would they have one page that calls the users profile from the db?
If they are using the one page method how is google able to index this type of thing if it doesn't physically exist.
thanks!
One page that calls the users profile from the db is the correct answer.
In apache web server on linux this is done using a special file called .htaccess that sits in a directory and consists of rules for sending the browser to a different page that is displayed. A very simple example of a .htaccess file would be:
tml and you can call it from the other url in the file - which remains displayed in the address bar.
.htaccess files use regular expressions too:
http://corz.org/serv/tricks/htaccess2.php - the first link from searching "htaccess mod rewrite" in google - looks like it covers it all in more detail.
In apache web server on linux this is done using a special file called .htaccess that sits in a directory and consists of rules for sending the browser to a different page that is displayed. A very simple example of a .htaccess file would be:
Options +FollowSymlinks
RewriteEngine On
RewriteRule page_that_does_not_exist.html page_that_does_exist.html
- in this example the page that the web browser displays is not the one that the user has typed into the address bar of the web browser. Create the page_that_does_not_exist.h.htaccess files use regular expressions too:
RewriteRule /user/(\w+)/ homepage.php?user=$1
In the example above the parentheses grab are used to capture a match and store it in $1 - fairly standard regular expression behaviour - which can then be passed as a GET variable to the script that is called. If you make multiple matches they go into $1,$2,$3 etc and you pick them up in your script as usual - in the example above you'd use $_GET['user']http://corz.org/serv/tricks/htaccess2.php - the first link from searching "htaccess mod rewrite" in google - looks like it covers it all in more detail.
ASKER
so with mod rewrite does google still index every user's page?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
great information thanks.
Any URL can be indexed by Google. The URL itself is not very important, except as a human-centric mnemonic. It's easier to remember something like http://twitter.com/LandonBaseball but the computers do not really care about the URL. Google cares about the content of the pages, most particularly about the title and h1 tags as well as the meta description. Google also cares about how many other pages link to any given page, and what the other page links contain in the text of the anchor tag.
This is a good book that teaches the basic design of data base backed web sites. General purpose scripts create the HTML for pages. The exact content of any page is determined from the contents of an underlying data model.
http://www.sitepoint.com/books/phpmysql4/
This is a good book that teaches the basic design of data base backed web sites. General purpose scripts create the HTML for pages. The exact content of any page is determined from the contents of an underlying data model.
http://www.sitepoint.com/books/phpmysql4/
If you're familiar w/ Joomla!, it does something similar when it changes a link using mod rewrite from
Open in new window
toOpen in new window