TurnKey Linux Virtual Appliance Library

Changing the default path for wordpress from root to <url>/blog

long.simon's picture

Hi guys, I'm trying to move my Wordpress blog over to turnkey Wordpress Virtual Appliance.

My current blog is http://www.simonlong.co.uk/blog and I need my new installation to be the same. 

With the default installation of Turnkey Wordpress it would make the wordpress blog apprear here: http://www.simonlong.co.uk/

How can I change this? Would it be easier just to reinstall a new Wordpress instance?


Alon Swartz's picture

You need to make 2 changes...

You need to make 2 changes, one to the wordpress configuration, the other to the apache configuration.

Wordpress: /var/www/wordpress/wp-config.php

define('WP_SITEURL', 'http://'.$_SERVER['HTTP_HOST']);
define('WP_HOME', 'http://'.$_SERVER['HTTP_HOST']);

define('WP_SITEURL', 'http://'.$_SERVER['HTTP_HOST'].'/blog');
define('WP_HOME', 'http://'.$_SERVER['HTTP_HOST'].'/blog');

Note that you might want to replace $_SERVER['HTTP_HOST'] with your domain name.

Apache: /etc/apache2/sites-enabled/wordpress

Alias /blog /var/www/wordpress

Add the above to the apache wordpress configuration, for example, after NameVirtualHost.

Once you have made the change, reload the apache configuration

/etc/init.d/apache2 reload

I hope the above helps.

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)