1

Google Blogger makes it easy to put a blog at a custom top-level domain or custom subdomain, such as:

www.example.com
blog.example.com

The setup involves creating a CNAME pointing to:

ghs.google.com

How do you setup a blog to be on a custom domain with a folder name in the URL path?

Example blog home:

www.example.com/blog

A CNAME won't work because that's at the DNS level not the HTTP level. A redirect will alter the URL in the user's browser, so that won't do either.

Is there a simple way to do this? (Note: My registrar is Namecheap and my site is running Apache/2.2.16 with cPanel on a unix server at Umbra Hosting.)

1

Here are 2 ways to do it.

Method #1: Using a "meta" tag

You could just stick a index.html file at the top of www.example.com that redirects to www.example.com/blog. This index.html file would make use of the "meta" tags that are available in the <head> tag:

For example

<html>
<head>
  <meta http-equiv="refresh" content="0;url=http://www.example.com/blog/">
  <title>www.example.com blog</title>
</head>

<body>
....
</body>
</html>

You can read more about them here.

NOTE: This method requires that you only want www.example.com/index.html to redirect to www.example.com/blog/.

Method #2: Using an Apache rewrite

#-- blog.example.com --#
<VirtualHost *:80>
  UseCanonicalName Off
  RewriteEngine On

  ServerName blog.example.com

  # blog 
  RewriteRule ^/(.*)$ http://www.example.com/blog/$1 [L,R=301]
</VirtualHost>

Method #3: Using an Apache Reverse Proxy

If you're attempting to take traffic in on say URL http://www.example.com/blog/ but your actual blog is at http://mysuperblog.blogger.com/, then another option would be to reverse proxy the mysuperblog.blogger.com behind an Apache instance tasked with sitting out in front.

#-- www.example.com/blog --#
<VirtualHost *:80>
  UseCanonicalName Off
  RewriteEngine On

  ServerName www.example.com

  # /blog -> /blog/
  RewriteRule ^/blog$ /blog/ [R]

  # blog
  ProxyPass /blog http://mysuperblog.blogger.com
  ProxyPassReverse /blog http://mysuperblog.blogger.com
</VirtualHost>

NOTE: In order to make use of Apache's reverse proxy functionality make sure that you enable the mod_proxy module.

|improve this answer|||||
  • 1
    The blog should end up on /blog, but the main site (not the blog) still needs to be at the root level. Additionally, a meta refresh would not cause the actual blog to appear at /blog. – Dem Pilafian Apr 14 '13 at 1:20
  • OK, you did not mention any of that in the question, you might want to update the question to reflect your more specific needs. – slm Apr 14 '13 at 1:22
  • The updated Method #2 seems a bit closer as it does not redirect the website root. Like Method #1, however, it looks like it points the browser to /blog but there won't be anything there (nonetheless, I gave the VirtualHost a try... encountered a 500 server error). What would cause the blog (hosted on Google Blogger) to show up at /blog? – Dem Pilafian Apr 22 '13 at 3:49
  • I think I understand what you're looking for finally. You want to present the site as www.example.com/blog even though it might be getting served from just blah.blogger.com (or whatever), correct? – slm Apr 22 '13 at 4:11
  • Yes, I want to know how to setup a blog to be on a custom domain with a folder name in the URL path. For example: www.example.com/blog – Dem Pilafian May 3 '13 at 21:05
0

Sadly, the answer appears to be no.

Blogger Settings Blogger Settings

It looks like there is no way to "setup a blog to be on a custom domain with a folder name in the URL path", such as:

www.example.com/blog
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.