Tag Archives: htaccess

Improve your Google Page Rank with 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

TTL = 14400

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]

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


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.

Free SEO benefits from future proof URLs

Future Proof URLs gives you free Search Engine Optimization (SEO) benefits and hide the technology for future modifications of server technology. Most users don’t care about the technology and true social media shares it’s information across multiple platforms.

It’s not easy to understand what this page is about from just a URL that looks like this:


Transform ugly URLs into Search Engine, People friendly URLs with these simple steps in the WordPress Admin Interface.

1. Go to Settings/Permalinks

permalinks view on WordPress Admin
permalinks view on WordPress Admin

2. Select “Day and name”, then click “save changes”

That will change the URL

from this: http://trickmandan.com/blog/?p=11

to this: http://trickmandan.com/blog/2008/11/23/redirect-root-requests-to-your-blog/

This strategy will give Search Engines some clues on how to index this page. User friendly URLs will also give users an extra clue on what the page is about.

NOTE: You may need to update your htaccess file in your WordPress directory.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]

This will redirect all requests that are not for actual files or directories to /blog/index.php

The [L] flag says this is the last rule.

Learn more about htaccess here.

Redirect root requests to your blog

In my article, “Installing WordPress” I mention how to redirect root requests to your new blog.

When I installed WordPress, I had nothing else on my server, but I wanted to reserve the root space for additional components, so I installed WordPress in a subdirectory named “blog”. Now I want all requests from my domain to just return the default view of my WordPress blog.

You can easily control this with an htaccess file in your root directory. Simply add the following line to your .htaccess file.

#I have nothing on root index, so redirect to /blog
RewriteRule ^(.*)$ /blog/index.php [L]

We can always go back and change this after we add new components and update the main index page.

This approach to the architecture will allow us to install other components and connect them in our root space. Let’s say we wanted to add a forum to the site. We could install the forum software in the /forums directory, then update the root space to show information about our blog and forums without disturbing the architecture of either component. This approach will allow us to easily integrate components at will and give us the ability to update the component through their natural interface.