Improve the SEO score of your Ghost blog with this tips
In the last article, I explain how I set up my Ghost blog using DigitalOcean. Today, we are going how to configure 301 redirect to redirect traffic from www to non-www.
HTTP 301 redirect indicates the permanent moving of a web page from one location to another. It is important to configure it to not lose potential traffic and improve the SEO score of your blog.
In the following examples, replace replace.me domain name by your own domain
Configure a new Ghost URL
Log to your Ghost server through SSH and configure a new URL with these commands:
# sudo -i -u ghost-mgr $ cd /var/www/ghost $ ghost config url https://www.replace.me $ ghost setup nginx ssl
A new Ghost URL has been configured. The Nginx SSL configuration and a fresh SSL certificate have been generated for
ghost-mgr user session to continue:
Configure HTTPS Redirection From WWW to Non-WWW Domain
The previous commands created a new Nginx configuration in
/etc/nginx/sites-available/www.replace.me-ssl.conf . We need to modify it a bit to redirect the client to the same non-www URL domain:
Configure HTTP Redirection From WWW to HTTPS Non-WWW Domain
The WWW HTTP configuration needs to be created from scratch. It redirects the visitors to HTTPS non-www domain URL:
Reload Nginx :
# nginx -s reload