Tuesday 6 August 2013

Redirect URL's index page to nonindex page

Try to use this important htaccess code for redirecting an URL's index page to non index Url’s. this code is very very important for seo point of view

 RewriteCond %{THE_REQUEST} /index\.html [NC]
RewriteRule ^/?index\.html$ http://www.maindomain.com/$1 [R=301,L]

Redirect URL from subdirectory to sub domain using htaccess

We can redirect URL's from any subdirectory (like maindomain.com/dorectoryname) to a sub domain (subdomain.maindomain.com) using PHP and .htaccess by the subsequent ways.
For example, the .htaccess file is full of rules like the following:
------------------------------------------------------------------------------------------------------------------------
RewriteCond %{HTTP_HOST} ^(www\.)?maindomain\.com$
RewriteRule ^dorectoryname/(.*)$ http://subdomain.maindomain.com/$1 [L,QSA,R=301]

or we can using this code
 
RewriteCond %{REQUEST_URI} ^/dorectoryname
RewriteRule ^(.*)$ http://subdomain.maindomain.com/$1 [R=301,L,P]
Related Posts Plugin for WordPress, Blogger...