Reputation: 9909
I am planning on migrating a blog that is currently hosted at
www.blog.com
to a subdirectory in a new domain such as
newdomain.com/blog
So far I've seen several tips on how doing this and [in particular from Yoast (Joost) is helpful but not identical to my situation 1.
Any suggestions?
The main steps on Joost's article are as follows:
[1 ] Edit wp-config.php
define('WP_SITEURL', 'http://www.newdomain.com');
define('WP_HOME', 'http://www.newdomain.com');
[2 ] Use the Search and Replace plugin to replace old URLs
[3 ] Update .htaccess to
Redirect 301 /blog/ http://www.newdomain.com/ // <== note this is NOT my situation
// I likely need the reverse
However, this won't address my particular need, in which a different change in .htaccess and wp-config.php may be necessary.
Any suggestions?
Upvotes: 0
Views: 1059
Reputation: 143906
Wordpress has some RewriteRules that it wants to use in an .htaccess file. It should look something like this:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
I think that all you need to do is take this and place it in an .htaccess file in your document root (where http://www.newdomain.com/ is). If you don't have any special rewrite rules or options in your .htaccess file, you could just move the file out of /blog/ and into /. You don't want these rules in both places.
Then in wordpress' admin panel (you'll need to go here: http://www.newdomain.com/blog/wp-admin/options-general.php ) there are 2 fields, one for WordPress address (URL)
(this should say http://www.newdomain.com/blog/ ) and one for Site address (URL)
(this should say http://www.newdomain.com/ ). And I think that's all you need to do.
If you are using custom themes you may want to double check any absolute URIs you have in the headers/footers/etc.
There's some more information about doing this here: Giving Wordpress It's Own Directory
EDIT: I forgot to mention that you need to create an index.php in your document root. In the link above, under the section Using a pre-existing subdirectory install, you need to follow the steps to create an index.php. You only need 2 lines.
As for the code-igniter/wordpress conflict. You may need to get the 2 rules to jive with each other, and that may not be so easy to do. You either have to move code-igniter's rules into their own directory or use RewriteCond
to make sure they don't step on each other. For example, adding a RewriteCond !/index.php
so wordpress' rewritten URI won't get re-rewritten by code-igniter's.
Upvotes: 1
Reputation: 14286
I would suggest a clean install. Just export your blog posts as XML, and copy over the uploads.
Upvotes: 0