After applying301 redirect my website is going to www.example.com/public_html? - Printable Version +- Twitist Forums (http://twitist.com) +-- Forum: General Social Media & Marketing Forums (/forum-8.html) +--- Forum: SEO Search Engine Optimization (/forum-30.html) +--- Thread: After applying301 redirect my website is going to www.example.com/public_html? (/thread-132302.html) |
After applying301 redirect my website is going to www.example.com/public_html? - teeny-tinyMenace251 - 04-08-2014 07:37 PM I am using this code in my .htaccess file of my PHP website for 301 redirection. RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] Redirection from non-www to www is successful but at the first time website is going to http://www.example.com/public_html Please can anyone tell, what I am doing wrong ? Thanks - Jake - 04-08-2014 07:46 PM Luckily my host control panel has a www rewrite control panel setting that generates the htaccess code. Here are a couple of guides on URL rewriting that should help: http://www.besthostratings.com/articles/force-www-htaccess.html http://perishablepress.com/stupid-htaccess-tricks/ http://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/ http://httpd.apache.org/docs/2.0/misc/rewriteguide.html For the readers: search engines treat www. and non www urls as separate addresses, effectively diluting the search ranking of a page, you want all links to the page to use the same form, rewriting it to the preferred form improves the chances that a visitor will copy and paste the right form. (www is pretty well treated like a subdomain, that's why some sites can use ww2 or wwww for the same function) |