WordPress.org

Ready to get started?Download WordPress

Forums

Change URL of sub domain on Multisite (6 posts)

  1. GreenDiablo
    Member
    Posted 1 year ago #

    Hi all,

    I'd like to change the subdomain url of a subsite on a Multisite WordPress install.
    Example: cat.domain.com => mouse.domain.com
    I'd also like to ensure that all old links redirect to the new url.
    Example: cat.domain.com/blog-post-1 => mouse.domain.com/blog-post-1

    In the "Edit Site" screen I saw that you can change the Domain, but I don't think it's quite that easy.

  2. Jesús Franco
    Member
    Posted 1 year ago #

    The change of host, being just the subdomain what it is changed, it's as easy as you can see, just edit that. However, you are right in your guess about the url's on your posts (and if you are using that, custom links in sidebar and menus).

    You can use phpMyAdmin to search and replace the links like it's shown in this page:

    http://blinktag.com/how-to-find-replace-in-mysql-for-wordpress-permalinks-that-have-changed/

    Or you could try with this plugin:
    http://wordpress.org/extend/plugins/search-and-replace/

    Don't hesitate to reply if you run into trouble attempting this. It's really easy, however don't forget backup your database before the change.

  3. I'd like to change the subdomain url of a subsite on a Multisite WordPress install.
    Example: cat.domain.com => mouse.domain.com

    That's not ... easy. Read http://halfelf.org/2012/moving-wordpress-multisite/

    You can do it, but you have to do a special search/replace with http://interconnectit.com/products/search-and-replace-for-wordpress-databases/ to get it done right for Multisite.

  4. GreenDiablo
    Member
    Posted 1 year ago #

    Thanks Jesús and Mika,
    Seems like it's not too bad of a move, but what about the re-direct to the new url? Will existing links (on social media etc.) automatically re-direct, is there a re-write rule I need to add or how can I achieve the redirect?

  5. You'll need a htaccess redirect.

    http://halfelf.org/2012/htaccess-anarchy/ has examples :)

  6. Jesús Franco
    Member
    Posted 1 year ago #

    About the rewrite rule, if your change is something as easy as you posted first (from cat->mouse same domain and /URLs...), cPanel offers a fairly easy way to configure "wildcard redirection". But what they do is just including a redirection like this in .htaccess:

    RewriteCond %{HTTP_HOST} ^cat\.example\.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.cat\.example\.com$
    RewriteRule ^(.*)$ "http\:\/\/kittens\.example\.com\/$1" [R=301,L]

    Edit: If you don't need redirection with or without "www", and just for the subdomain in question, remove the second rule and the [OR] keyword after the first one.
    `

Topic Closed

This topic has been closed to new replies.

About this Topic