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.

Guest's picture

Permalinks problem

Hey I tryed and it works but when I enable the permalinks too many redirects appears. Could you help me? How I can hande it?

Jeremy Davis's picture

I suspect some conflicting Apache and/or WordPress config

My guess is that the webserver is getting stuck in a redirect loop (between Apache2 and WP config).

TBH I have no experience with WordPress but it seems like a fairly generic Apache2/WordPress config issue than it is a specific TurnKey Linux issue. I suggest that you consult WP experts (i.e. try posting on the WordPress community forums). I imagine that someone expert in the field would be able to help you out in a flash!

Assuming that you resolve your issue it'd be great if you could post back to help others.

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)