Support » Networking WordPress » Redirecting deleted/unot found blogs to a new system

  • hello wordpress wizards

    I am upgrading from a subdomain based system using WPMU2.7 to folder based WP3.12 multisite system

    i am redirecting

    http://USER.domain.com/blogs/somethinhere/
    to
    http://domain.com/blog/USER/somethinhere/

    the modrewrite that makes the job is

    RewriteCond %{HTTP_HOST} ^(.*)\.domain\.com$ [NC] !-f
    RewriteRule ^blogs/(.*)$ http://domain.com/blog/%1/$1 [R=301,L,NC]

    however, i need to totally delete the old system (or rename it) for this code to work. as long as the old system is in place, wordpress current .htaccess overwrite the rule and simple send deleted old blogs to the main old blogs site….

    how can i add the redirection above to work with the current .htaccess

    RewriteEngine On
    RewriteBase /blogs/
    
    #uploaded files
    RewriteRule ^(.*/)?files/$ index.php [L]
    RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
    RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L]
    
    # add a trailing slash to /wp-admin
    RewriteCond %{REQUEST_URI} ^.*/wp-admin$
    RewriteRule ^(.+)$ $1/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule . - [L]
    RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
    RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]
    
    <IfModule mod_security.c>
    <Files async-upload.php>
    SecFilterEngine Off
    SecFilterScanPOST Off
    </Files>
    </IfModule>

    so, i could literally DELETE the blogs that i finished transfer and the server will point to the new system

    thanks for any leads.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Halfelf Rogue & Plugin Review Team Rep

    Are you redirecting or moving?

    And is USER the blogname?

    Cause … it would PROBABLY be easiest to export and import everyone.

    Otherwise there’s a LOT of DB hassle to go on for that as a real fix.

    after considering all options, and since there are only about 170 blogs, we are manually visiting every blog, clearing spam, than exporting the content to an xml file.

    the next stage is to create new user/blog at the new site, and importing the xml content file.

    once this is done, i want to delete the old blog and use the .htaccess redirect mod to divert traffic from the old (subdomain) site to the new installation (folder). the ,htaccess rule works fine if i remove the wordpress .htaccess… it seems that it interfere or overwrite the redirection rule, and simply treat the deleted blog as a 404 – showing the main blog….

    my question is how i can use the redirection along with the build in htaccess of wp to redirect the deleted blogs….

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Halfelf Rogue & Plugin Review Team Rep

    it seems that it interfere or overwrite the redirection rule, and simply treat the deleted blog as a 404 – showing the main blog….

    What’s the URL structure of where it’s pointing to, though?

    http://USER.domain.com/blogs/somethinhere/

    should point to to

    http://domain.com/blog/USER/somethinhere/

    but when i delete USER blog, WP treat it as an internal 404 and redirect to

    http://domain.com/blog/

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Halfelf Rogue & Plugin Review Team Rep

    Let me make sure I get this…

    When you have your extant redirect code in your .htaccess (and I am assuming you put that ABOVE the WordPress stuff), and you go to http://USER.domain.com/blogs/somethinhere/, you’re INSTEAD sent to http://domain.com/blog/?

    That’s not how WordPress handles redirects for 404s, you know.

    Go to http://ipstenu.org/jksdfsdfsdf and it keeps you on http://ipstenu.org/jksdfsdfsdf

    The only thing that stands out to me is RewriteBase /blogs/, which is no longer your base location.

    when i have the redirection code ONLY in the htaccess it works.

    when I have it above the WP code in the htaccess

    USER[deleted].domain.com/blogs

    is not redirecting to

    domain.com/blog/USER

    but to
    domain.com/blogs

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Redirecting deleted/unot found blogs to a new system’ is closed to new replies.