Forum Moderators: phranque

Message Too Old, No Replies

Moving blog to subdirectory

wordpress and premalink issue

         

digic

12:19 pm on Sep 6, 2009 (gmt 0)

10+ Year Member



Hi,

I am using wordpress on my site and wanted to optimized more my homepage for a different design/idea.

I have almost a thousand post already, moving my whole site on the subdirectory is not a problem, what I am worry is the 404 when I moved all contents? Is there a way to work around this without loosing an inbound link and have that 404 probleams?

Thanks again.

jdMorgan

3:04 pm on Sep 6, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The usual way to do this is to 301-redirect all WP URL requests to the subdirectory.

By modifying the original WordPress-supplied .htaccess code to check for "file-or-directory-exists" in the subdirectory as well as in the "Web root" directory, you can restore WP's original function of "If the requested URL doesn't resolve to an existing file or directory, rewrite it to WordPress."

Some optimizations are likely possible as well, since the WP_supplied code isn't optimized.

The good news is that after most of your URLs are updated, you can modify the code to make your site much more efficient, if after a year, you just let all or most of the old, un-updated URLs go 404.

The only problem with this scheme is that all 404 errors must be handled by WordPress. There's nothing you can do about that, though, if you intend to keep both 'sites' on the same domain.

Jim

digic

9:30 am on Sep 7, 2009 (gmt 0)

10+ Year Member



"The usual way to do this is to 301-redirect all WP URL requests to the subdirectory."

Hi JDM,
So how can I do it in .htaccess file. Here is my sample URL

from:
www.mysite.com/?p=123456

to:
www.msysite.com/moved/?p=123456

Thanks a lot

jdMorgan

1:34 pm on Sep 7, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Use Apache mod_rewrite (Please see the documentation cited in our Apache Forum Charter, as well as reading the charter itself.)

We'll be happy to help you get *your* code working, but we cannot write it for you here. You might also want to try the WebmasterWorld search facility, as Rewriting WordPress directories using RewriteRule and RewriteCond in mod_rewrite comes up fairly often here.

Jim