Solved

Site archetecture question

Posted on 2011-02-19
6
810 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Get Database Help Now w/ Support & Database Audit

Keeping your database environment tuned, optimized and high-performance is key to achieving business goals. If your database goes down, so does your business. Percona experts have a long history of helping enterprises ensure their databases are running smoothly.

Question has a verified solution.

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

Suggested Solutions

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.
Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

752 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