This Forum has been archived there is no more new posts or threads ... use this link to report any abusive content
==> Report abusive content in this page <==
Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
After applying301 redirect my website is going to www.example.com/public_html?
04-08-2014, 07:37 PM
Post: #1
After applying301 redirect my website is going to www.example.com/public_html?
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

Ads

Find all posts by this user
Quote this message in a reply
04-08-2014, 07:46 PM
Post: #2
 
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/...ccess.html

http://perishablepress.com/stupid-htaccess-tricks/

http://www.addedbytes.com/articles/for-b...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)

Ads

Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)