Forum Moderators: phranque
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]
RewriteOptions inherit
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]
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