Wednesday 12 August 2015

When we discuss web improvement and site creation on the web, numerous things we have to consider before pushing ahead to manufacture sites online and the most vital thing is redirection i.e., redirection like diverting www to non-www or the other way around. This is the most touchy thing that ought to be repaired when setting a site. Thusly, I've composed this article to help individuals appropriately divert www to non-www by means of .htaccess document in Apache based servers.

This is the most far simple approach to constrain a site clients to utilize the www or non-www rendition of your site. It is additionally vital so as to anticipate copy content in web indexes. That is the reason we must consider diverting clients to utilize either the www or the non-www form of your site space.

Note: You can either compel your site clients to www rendition of your site or non-www form utilizing .htaccess document. In the event that you are utilizing WordPress then you can alter .htaccess document from WordPress dashboard or you can utilize FTP customer to alter .htaccess record.

Appropriately Redirect www to non-www or Vice Versa 

1. Power clients to utilize http://www.yoursite.com 

The accompanying code will constrain your clients to utilize the www form of your site to get to the greater part of the substance that is available in your site. Simply duplicate and glue this code in your .htaccess document and change the area name to your space name from the code:

# Redirect www urls to non-www
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.yoursite\.com [NC]
RewriteRule (.*) http://yoursite.com/$1 [R=301,L
2. Power clients to utilize http://yoursite.com 

Then again in the event that you need to divert your site clients to non-www form of your site to get to the majority of the substance of your site. Glue the accompanying code in your .htaccess record and change the space name to your area name from the code:

# Redirect non-www urls to www
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yoursite\.com [NC]
RewriteRule (.*) http://www.yoursite.com/$1 [R=301,L]
clusion 

That is the way we do this. For any inquiry remark beneath.

0 comments:

Post a Comment