Permanent redirect from non-www to www a Ghost blog with Apache

A domain with www and without www will recognized as different URL by search engines. In addition, most people will type in the blog URL without the www automatically on their browser, it’s a habit, right?. If you don’t set it up, then when the visitors opened your blog without www, they will see the “page not found”.

To redirect from non-www domain to the www a Ghost blog, you can use Apache. You can redirect it permanently.

I’m using Ubuntu and here is my config.
I created two VirtualHost in sites-avaiable directory.

For non-www:

Redirect permanent /

And for www domain:

ProxyPass /
ProxyPassReverse /
ProxyPreserveHost On
RewriteEngine On
RewriteOptions inherit

The URL in config.js for Ghost is using www.
Don’t forget to reload your Apache service.

I’m using port 8080 because I also running Varnish and my Ghost blog is running on port 2370 because the default port is used for my another Ghost blog.


Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:


You are commenting using your account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s