Solved

Site archetecture question

Posted on 2011-02-19
6
811 Views
Last Modified: 2012-05-11
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!
0
Comment
Question by:Solutionabc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 2

Expert Comment

by:TimBare
ID: 34935322
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
 
LVL 6

Expert Comment

by:MatthewP
ID: 34935590
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
 

Author Comment

by:Solutionabc
ID: 34937509
so with mod rewrite does google still index every user's page?
0
Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

 
LVL 6

Accepted Solution

by:
MatthewP earned 500 total points
ID: 34937558
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
 

Author Comment

by:Solutionabc
ID: 34937775
great information thanks.
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 34937778
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

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question