In message <[EMAIL PROTECTED]>, Mian Waqas
<[EMAIL PROTECTED]> writes
>Hi Friends,
>
>My client requires that his site should open only using www in the URL 
>like http://www.sitename.com/anypage.php and no one should be allowed 
>to access it using this URL http://sitename.com/anypage.php. If some 
>one type this URL http://www.sitename.com/anypage.php than it should 
>automatically convert to http://www.sitename.com/anypage.php

I think that this could be an ongoing problem with Google (although they
may have fixed it now), where they think that you have duplicate
content, because they can see yoir site twice.

>From my .htaccess
=====================================
RewriteEngine On

RewriteCond %{HTTP_HOST} ^mysite\.com$ [NC]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,L]
=====================================

I am not totally sure that Rewriteengine on is required here, try it...

It is possible to do it in PHP, but if you were going to do it in PHP,
then you would have to find a way of adding code to every page, even the
odd HTML page, so I feel that .htaccess is simpler.

-- 
Pete Clark

Free advertising for your website, business, or organisation at:
http://www.hotcosta.com






------------------------ Yahoo! Groups Sponsor --------------------~--> 
See what's inside the new Yahoo! Groups email.
http://us.click.yahoo.com/2pRQfA/bOaOAA/yQLSAA/HKFolB/TM
--------------------------------------------------------------------~-> 

Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to