Welcome to WebmasterWorld Guest from 54.205.17.36

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

redirect to prevent duplicate content

     
4:42 pm on May 28, 2009 (gmt 0)

Junior Member

5+ Year Member

joined:Sept 10, 2008
posts: 79
votes: 0


Hi I have a question of anyone who can help.

I have a Blog built within my site

When I find my blog in the search engine it points to example.com/blog with no WWW. My main site www.example.com looks fine and my htaccess redirects fine.

How do I make it work for my blog also?

This is what I have

ErrorDocument 404 /404page.htm
RewriteEngine on
rewritecond %{http_host} ^example.com [nc]
rewriterule ^(.*)$ http://www.example.com/$1 [r=301,nc]

Any help would be appreciated.

[edited by: jdMorgan at 5:10 pm (utc) on May 28, 2009]
[edit reason] example.com [/edit]

5:13 pm on May 28, 2009 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


In the mod_rewrite code in the .htaccess file in your /blog subdirectory, try adding

RewriteOptions inherit

This is set by default on most hosting companies' servers, but not always.

The other alternative is to duplicate the redirection code in /blog/.htaccess:


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

(Note the corrections: These apply to your main code as well, except for the addition of the /blog path-part.)

Make sure that all links within your own site point to www.example.com, and not to example.com. You don't want to confuse the search engines, and you don't want to make your visitors suffer a redirect delay unnecessarily.

Jim

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members