WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Changing from subdomains to directories (7 posts)

  1. vrensen
    Member
    Posted 1 year ago #

    Hello,

    In reference to this closed topic I have some additional questions.

    My situation differs from the one above in that way that I want to move 5 existing subdomains on a multisite install to subdirectories, YET ON THE EXISTING SERVER and preferably on the EXISTING WP MULTISITE INSTALL. What I planned to do after backing up all content and data, is NOT to export all posts, yet to change all URL's of existing databases new sites (with subdirectories) with the script, adapt the htaccess and create redirects for the old subdomains, pointing to the newly created subfolders.

    I have the following questions before proceding with the above mentioned steps:
    - If I change subdomain install to false, will the subdomains and the site actually still be active as such? In other words can I run this operation in parallel?
    - If not I can I avoid downtime?
    - Can I keep using the multisite install?
    - Do I have to changes prefixes as well and if so, how?

    Cheers
    Cas

  2. http://codex.wordpress.org/Multisite_Network_Administration#Switching_network_types

    And then you'll want to search/replace in your datbase to change the URLs. I would use the script mentioned here: http://codex.wordpress.org/Moving_WordPress#Moving_WordPress_Multisite

  3. vrensen
    Member
    Posted 1 year ago #

    Hello Mika,

    I changed from subdomains to subdirectories. 5 of 8 subdomains tranferred correctly. Three however don't: it shows 'Index of' but no site. Can't access the wp-admin file neither: returns a 404. The directories not showing anymore are http://www.deliciousnature.com/italianfood, http://www.deliciousnature.com/lozaff and http://www.deliciousnature.com/alledagenitalie.

    Any idea why these don't work and the others do?

    Thanks,
    Caspar

  4. vrensen
    Member
    Posted 1 year ago #

    @ ipstenu

    I managed to solve the above mentioned issue. Because I created subdomains through cPanel it created an empty install of WP.

    Still have another challenge though: my htaccess rules don't redirect correctly. I followed the exact steps indicated here, but it still redirects to the main domain instead of the various subdirectories.

    This is what my .htaccess looks like:

    #Subdomains
    RewriteCond %{HTTP_HOST} ^alledagenitalie.deliciousnature.com [OR]
    RewriteCond %{HTTP_HOST} ^www.alledagenitalie.deliciousnature.com
    RewriteRule ^(.*)$ http://deliciousnature.com/alledagenitalie/$1 [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^lozaff.deliciousnature.com [OR]
    RewriteCond %{HTTP_HOST} ^www.lozaff.deliciousnature.com
    RewriteRule ^(.*)$ http://deliciousnature.com/lozaff/$1 [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^italianfood.deliciousnature.com [OR]
    RewriteCond %{HTTP_HOST} ^www.italianfood.deliciousnature.com
    RewriteRule ^(.*)$ http://deliciousnature.com/italianfood/$1 [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^yogaholidays.deliciousnature.com [OR]
    RewriteCond %{HTTP_HOST} ^www.yogaholidays.deliciousnature.com
    RewriteRule ^(.*)$ http://deliciousnature.com/yogavakanties/$1 [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^gastronomicholidays.deliciousnature.com [OR]
    RewriteCond %{HTTP_HOST} ^www.gastronomicholidays.deliciousnature.com
    RewriteRule ^(.*)$ http://deliciousnature.com/culinairevakanties/$1 [R=301,L]
    
    # BEGIN W3TC Browser Cache
    <IfModule mod_deflate.c>
        <IfModule mod_headers.c>
            Header append Vary User-Agent env=!dont-vary
        </IfModule>
            AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json
        <IfModule mod_mime.c>
            # DEFLATE by extension
            AddOutputFilter DEFLATE js css htm html xml
        </IfModule>
    </IfModule>
    # END W3TC Browser Cache
    
    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*.php)$ $2 [L]
    RewriteRule . index.php [L]
    # END WordPress

    How now do I get the old URLs to redirect properly to the new ones (those in subdirectories)?

  5. Check your database first.

    Go look at wp_blog and see what the domain and path values are.

  6. vrensen
    Member
    Posted 1 year ago #

    Thanks Mika, that's indeed what I did. I forgot www. before the domain name. It works now.

    Thanks

  7. vrensen
    Member
    Posted 1 year ago #

    I thought I had it all sorted out, but I ran into a new problem. I had to change hosts once of a sudden. So I uploaded the backup through FTP on the new server, created 2 nameservers, pointed the old ones and since then I can't access any page anymore that's in the root, including my wp-admin. Strangely enough I CAN access all subdirectories and subsequent pages and wp-admin. Also my redirection didn't work anymore. Not even after creating new subdomains on the new server.

    Any idea what could be the problem?

    Thanks,
    Caspar

Topic Closed

This topic has been closed to new replies.

About this Topic