Posts Tagged ‘URL Mapping’
You may wonder about the mysterious Google Page Rank and why it’s different when you check you site with and without the leading “www” for you domain.
Now this web strategy will point all that Google page rank power to one domain with simple URL Mapping. This will also fix the broken links when friendly fans have linked to you site, but forgot a “w” or added too many.
How to use URL Mapping
Let’s say your site is: “yoursite.com” just make these instructions easy.
This method takes advantage of mod_rewrite, make sure your server supports mod_rewrite additional URL Rewriting is available on the Apache site here.
Modify your server configuration file
Add the following entry: ServerAlias *.yoursite.com
Create a DNS entry for your site
DOMAIN = *
TTL = 14400
RECORDTYPE = CNAME
Modify your htaccess file
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
#Fix leading w problem by WebTechMan.com
#This will permanently redirect all calls to
#your site with one or more leading w to your site.
RewriteCond %{HTTP_HOST} ^(w+\.)(.+)$ [NC]
RewriteRule (.*) http://%2/$1 [R=301,L]
</IfModule>
Restart your Server
Now go to your site and test it out, try WwwwW.yoursite.com, Ww.yoursite.com, www.yoursite.com, … These should all redirect to yoursite.com
Notes
You may not be concerned about your page rank in your Enterprise 2.0 deployment of your social media platform, but you may be interested in similar techniques for pretty / future proof URLs. This is another part of Strategy 2.0 that will make your cool AJAX and other Web 2.0 calls to data much easier with a RESTful architecture.
Instead of “yoursite.com/index.php?a=2&m=239″, you could have “yoursite.com/members/webtechman/edit”.
You could use this strategy in your enterprise 2.0 platform by adding the following lines to your .htaccess file and capture the information in you social media platform.
# URL Mapping for pretty/future proof URLs
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1
Contact me or leave a comment here if you would like to know more about this.
Tags: Google, htaccess, URL Mapping
