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!
SolutionabcAsked:
Who is Participating?
 
MatthewPConnect With a Mentor Commented:
Yeah it does because as far as the outside world can see they're all real pages with different content. I use Mod rewrite for providing search engine friendly urls where index.php?id=5&content=9&template=34 for example is pretty meaningless to both search endines and users.

I have things on my sites like:
RewriteRule products/(\d+)/?.*?$ index.php?s=9&content=95&template=15&product_id=$1

Open in new window

This allows a url such as mysite.com/products/5129/Title-of-my-product.html to call up a product entry from a database. Matching with .* after the id allows the title to be completely irrelevant to what is served, therefore it can be tailored for SEO - only the product id which is captured by \d+ (one or more numbers) is actually passed to the script, the product title is of course read by search engines and users alike. All the script does at the other end is get the value of $_GET['product_id'].

Note this is all an apache web server thing, though similar methods are available for Windows if you host on there: http://www.micronovae.com/ModRewrite/ModRewrite.html for example.
0
 
TimBareCommented:
they usually use mod rewrite to rewrite the URL... So you're right. they don't have different pages.

If you're familiar w/ Joomla!, it does something similar when it changes a link using mod rewrite from
http://tbare.com/index.php?option=com_content&view=article&id=4&Itemid=4

Open in new window

to
http://tbare.com/portfolio

Open in new window

0
 
MatthewPCommented:
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:
Options +FollowSymlinks
RewriteEngine On
RewriteRule page_that_does_not_exist.html page_that_does_exist.html

Open in new window

- 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.html 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:
RewriteRule /user/(\w+)/ homepage.php?user=$1

Open in new window

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.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
SolutionabcAuthor Commented:
so with mod rewrite does google still index every user's page?
0
 
SolutionabcAuthor Commented:
great information thanks.
0
 
Ray PaseurCommented:
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/
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.