Authorization

What is one of the most challenging issues for bloggers who want good standpoint from search engine? It’s canonicalization, a process of converting the data with more than one representation into the canonical standard. Bloggers concern very much with this issue this process that will define the duplicate content of blogs or otherwise through the so-called algorithms work to sort the data repetition in order. Yet, this hot issue has been tactically responded through the redirecting the blogs from www to non-www or conversely.
In fact, the URL canonicalization is a long topic of discussion where people in common make a mistake to understand about. URL canonicalization is believed unable to go beyond www and non-www. Yet, the know-how basics are still out of the track. Let’s discuss this topic to get a precise insight on URL canonicalization in relation to an effort of redirecting www to non-www or vice versa.
A problem of 301 Permanent Redirect plugins
We normally find within the plugin directories of WordPress similar utility for redirecting www with 301permanent redirect. Actually, most of these plugins are not helping much to make URL canonicalization effects come away from our blogs, since one version include the functionality of Apache-based redirection, 404 monitoring, and many more. I do not need to mention the names of other remaining plugins due to the fact that they are superfluous. Furthermore, some of these redirecting options could distract the performance of your WordPress blogs.
The case is basically not the simplicity of the redirection tools available in the plugins. Using such plugin to remove the meta data header tags from the given standardized WordPress header doesn’t allow modifying the codes that have been set up. If only it is possible, we can simply upgrade and that will serve what we want from redirecting effort.
Here you a typical WordPres redirection taking the following process.
Web browser → Web server → WordPress(PHP) → MySQL
Since the data is within MySQL database, we need to through these steps and thereby every adds could delay the on-the-way process. The opposite redirection steps will be simply otherwise where the delay occurs in every single step.
When the web server is already optimised, it will neglect the necessity of using PHP to process static files and others. It means that you have already added your CPU and server with unnecessary memory usages. As a result, the effects of redirection are not only delayed-time use, but also the basic principle of performance wisdom itself. In short, we have to stay away from using the WordPress core plugins to redirect www to non-www and conversely. No way!
Web Servers can Help
Most of web servers support the redirecting process. It is a common use and service. We can decide on whether 301 redirect or 302 redirect tool to remove our site contents in the web browsers, no matter the object will be from different page, from the same domain, or even from the external domain that corresponds properly.
The process of redirection will be from Web browser to Web Server
Web Browser → Web Server
In order to deal with the ‘threatening’ URL canonicalization effects as well as to avoid duplicate contents ‘charge’, we have to use a 301 redirect option. Yet, if we prefer the version of www while internet users tend to have non-www, the web server will automatically return to 301 Moved Permanently code in the header. That is, that includes the new URL address in the header. Therefore, we have to make sure which version of URL we please to have before implementing the redirecting code. Simply realize that non-www version is much shorter than the www ones.
For more detailed learning topic, the rubbish codes use regular expression (known as regex) to fit the target domain. The marking sign (^) means start of a string. In fact, we do not need to understand more about it, except we are willing to learn in depth some advanced configuration of website.
Bear in mind that this solution applies for all types of blogs and websites and thereby we do not have to enable supporting software and blog platform to make it work.
Redirecting www with Apache
When redirecting an URL with Apache turns to be our choice, we have to put it into .htaccess file in the specific directory of the website, blogs. This applies even if the blogs are in the sub-directory.
mod_rewrite module is needed to help execute this redirection process. Yet, if you have such cool URL features for the blogs and websites, it means that you have got them all.
Here you the code to redirect www to non-www
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*) http://%1/$1 [R=301,L]When you include the domain name, please use the following code
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L] Redirecting www with nginx
When we would like to redirect www to non-www, we need rewrite modules which are scheduled as standard HTTP module. This takes place during the compilation of nginx. For good news, all Linux packages have included this feature for the users.
Let’s get started! Add the code to the top of the page. Separate it from the server {} section for the preferred canonical name that we want. Therefore, add the following code when you want to redirect www to non-www:
server {
listen 80;
server_name www.example.com;
rewrite ^/(.*) http://example.com/$1 permanent;
} The word permanent is the keyword used that helps turn the redirecting process to 301 re direction. Afterwards, we can simply configure the domain without www at the first URL name.
So, what is the code to redirect non-www to www? Here you the code
server {
listen 80;
server_name example.com;
rewrite ^/(.*) http://www.example.com/$1 permanent;
} Redirecting www with lighttpd
We need mod_redirect module as well. We need to put it nearby the top of file configuration. We have to do this before redirecting and rewriting the required rules. Here you the code for redirecting www to non-www.
$HTTP["host"] =~ "^www\.(.*)$" {
url.redirect = ( "^/(.*)" => "http://%1/$1" )
} On the contrary, when we want to redirect non-www to www in the same domain name, follow the code below.
$HTTP["host"] =~ "^example\.com$" {
url.redirect = ( "^/(.*)" => "http://www.example.com/$1" )
} Editing Server Configuration
As a matter of fact, web hosting providers let individual users to edit the given configuration from the options per directory. Simply drop a .htaccess on the directory of your websites. Logging in the web hosting account, you will be able to start editing the configuration of your websites. Use the Panel editor provided or any available web administration interface. In this case, we don’t have to reload Apache server since it will read .htaccess in the given directory once we access it.
How about lighttpd and nginx? We have to have direct access to our own configuration files. If this is impossible, ask to the admin for helping edit your existing configuration. Finally, you have to reload and restart the new configuration to make it work. Have a nice configuration!
[via blogbuildingu.com]
Comments (10)
RSS Collapse / Expandcurt
willsonn
percyloverboy09
izza301
rahulroyy
liaisesolutions
HelenOlsson
HelenOlsson
Only Registered and authorized users may post comments