random thoughts

Move Wordpress Blog From Root to Subdirectory

am quite sure you will get a lot of tutorials for this topic

try this http://www.google.co.in/search?q=move+wordpress+blog+from+root+to+su bdirectory

but that didn solve one particular problem,  redirecting the old url to new url.

earlier i had my blog in the root directory on my domain http://www.rajeshpg.com.i moved my blog to a subdirectory http://www.rajeshpg.com/blog.i reinstalled wordpress in the subdirectory,and import my earlier posts.

The problem is that the old url for a post (probably indexed by google) should be redirected to new url.

example:- http://www.rajeshpg.com/2007/01/javaxservletservletexception-path- loginlayout-does-not-start-with-a-character/ should be redirected to http://www.rajeshpg.com/blog/2007/01/javaxservletservletexception-path- loginlayout-does-not-start-with-a-character/

After googling for an hour i got the solution.

modify your .htaccess file(or create one) in the root directory with this code.

RewriteEngine On RewriteBase / RewriteRule ^(\d*)/(\d*)/(.*)$ http://yourdomainname.com/blog/$1/$2/$3 [L,R=301] (\d) represents a sequence of numbers. (.) represents sequence of characters.

note:- this solution works only for the urls of /year/month/title pattern of wordpress blog.

Comments