I am going from multi site to single site. Multi site used

I am going from multi site to single site. Multi site used folders for subsites.

I need help redirecting folders for the single site. Can you please tell me the rewrite rule for htaccess.

Thanks,
Robin

  • Sajid

    Hi @robin41,
    Hope you are doing well :slight_smile:

    I am assuming you want to install each subsite in a subdirectory in single site ? If yes then you don't need to worry about custom redirects.

    For example if you have a subsite like this http://www.yourdomain.com/subsite, and have installed WordPress single site in folder /subsite on your server then it will automatically load the correct website for you.

    So, what I am trying to explain is instead of using virtual directories, install your single WordPress on physical directories. Server will handle the rest.

    Please let me know if its not what you want or you have custom domains for each subsite.

    Take care and have a nice day :slight_smile:
    Cheers, Sajid

  • Robin Bennett

    Sounds like that would have been the best way to do it.

    The multi-site had folders cooking/living/traveling

    But the single site now has no folders - http://addapinch.com

    So now if you go to http://addapinch.com/living for example, you get a 404 error. The rewrite rule I tried did not work - RewriteRule ^living/(.*)$ http://addapinch.com/$1 [R=301,L]

    We also have rewrite rules to remove the date from the permalink from previously - RedirectMatch 301 ^/living/([0-9]{4})/([0-9]{2})/([0-9]{2})/(?!page/)(.+)$ http://addapinch.com/living/$4

    so also wondering if we get the redirect rule to work to redirect the folder - do we need all of the redirects for permalinks to remove the date or just one?

    Hope that makes sense

    Robin

  • Sajid

    Hi Robin,
    Hope you are doing good today :slight_smile:

    So that means you have all the content of subsites on your main website ? And want to redirect old URLs to new URL. Instead of creating multiple single sites ? Right ?

    Try this code to redirect if url contains a specific directory (did not tested though).
    RewriteRule ^/living/(.*)$ http://addapinch.com/$1 [R=301,L]

    I am not sure why you want to remove the dates. You can simply redirect to a different URL based on your condition.

    Take care and have a nice day :slight_smile:
    Cheers, Sajid

  • Robin Bennett

    Yes, we did export/import from the multi-site to the single site for all of the subsites. Most bloggers these days now want dates removed from permalinks so they can repost old posts without having to do a redirect on each post and to make sure all of their "previous" links on facebook, twitter, pinterest, etc. continue to work

    Would this be the correct rule to do all of the subsites in one rewrite

    RewriteRule ^/(cooking|living|traveling|homeschooling)/(.*)$ http://addapinch.com/$1 [R=301,L]
    and then add
    RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/(?!page/)(.+)$ http://addapinch.com/$3

    to redirect links with dates

    Thanks,
    Robin

  • Sajid

    Hi @robin41,
    Hope you are doing good today :slight_smile:

    Well, I discuss with my colleague but we both are confused what exactly you want to do here. Can you please explain exact what you are trying to do here, specially with example so we know exactly what we are trying to accomplish.

    Also, to make it clear, redirecting one post of two different categories will cause issue later. For example if user A is coming from yourdomain.com/living/my-post and user B is coming yourdomain.com/traveling/my-post and we have a rewrite URL to redirect user from these categories to one url yourdomain.com/my-post then both will see one content even if they are trying to see content from two different categories.

    Hope that makes some sense and look forward towards your response :slight_smile:
    Cheers, Sajid

  • Tyler Postle

    robin can you send in your FTP and wp-admin so we can have a closer look?

    You can send that privately through our contact form: https://premium.wpmudev.org/contact/

    Select "I have a different question" for your topic - this and the subject line ensure that it gets assigned to me.

    Send in:

    Subject: "Attn: Tyler Postle"
    -WordPress admin username
    -WordPress admin password
    -login url
    -FTP credentials (host/username/password)
    -link back to this thread for reference
    -any other relevant urls

    **If you keep support access active then no need to send in wp-admin

    Look forward to hearing back!

    Cheers,
    Tyler

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.