Forum: 

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

Simon Long'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?

Simon

Alon Swartz's picture

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


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

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

After
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.

Anton's picture

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

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