Forum Moderators: phranque

Message Too Old, No Replies

301 redirect to subfolder

         

rippelhans

8:54 pm on Aug 31, 2010 (gmt 0)

10+ Year Member



I've installed Wordpress MU and it moved my blog from simply www.mydomain.com/category/post.html to www.mydomain.com/blog/category/post.html
I would need both the regular www redirect plus a redirect so all my posts have the added /blog/ subfolder. What's the best way to go about this? Any help is much appreciated!


The redirect I have is my .htaccess www redirect under html/example.com is:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301]
AddHandler php5-script .php

jdMorgan

1:07 am on Sep 2, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The problem here is defining "all my posts" in terms of the current URL.

It's unclear why you wanted to change all of your URLs -- this was not really required if all you changed was the directory used for WP file storage. Keep in mind that URLs and filepaths are two different things, and a change in one does not imply a change in the other...

You'll likely need to move and adapt the WPMU .htaccess code from /blog/.htaccess to /.htaccess to make this work if you use the root directory or have subdirectories in addition to /blog in your root directory. You might want to post that code here as well.

Jim

[edited by: jdMorgan at 1:06 pm (utc) on Sep 2, 2010]

rippelhans

1:20 am on Sep 2, 2010 (gmt 0)

10+ Year Member



thanks jdMorgan, actually only the URL structure changed not the actual directory. After I installed Wordpress MU it added /blog/ to my URL structure. Can I just undo that change instead of having to code the .htaccess file?

jdMorgan

1:07 pm on Sep 2, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't use WP, so I don't know. If there is no need for the /blog/ URL-path-part in the URL, then look into the 'configuration settings' of the WP installer to see if you can get rid of it.

I assume that you have some actual need for WP MU, or you wouldn't have installed it. Consideration of the "Multiple Users" aspects on your your site may greatly affect the "proper design" of a solution, and coding should be deferred until all of the attendant issues have been considered and all the requirements are known.

Note that I botched the typing in my previous response. I have corrected it to avoid further propagation of the resultant totally-incorrect comment. My apologies for nay confusion this may have caused...

Jim