Moving site to new server - trouble with relative URLs
I'm moving my Wordpress driven site from a shared hosting account to my UKFast account and I'm having trouble getting the site replicated on the new server due to the relative URLs I'm using.
My URLs have to be in the format below:
http://ipaddress/~username/
This then reads the public_html folder.
I am using cPanel on an Apache server if that helps.
If I change image URLs in my stylesheet from /wp-content/themes/themename/images/image.jpg to ~username/wp-content/themes/themename/images/image.jpg then it all works. Problem is I don't want to have to go in and remove all entries of ~username/ 开发者_如何学Pythonfrom image and file URLs when I've switched the DNS settings and the new server is the active one.
There's a WP Setting in your wp-config.php called WP_CONTENT_DIR. You can setup your Base URL http://ipaddress/~username/ there.
define( 'WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/blog/wp-content' );
Further information here.
精彩评论