• denis24

    (@denis24)


    I’m developing a WordPress/WooCommerce site to replace an existing HTML ecommerce site. Since it’s a big site with a few thousand products, we decided to start by building a WP site for only the wholesale products.

    The current site is at example.com and the current wholesale products are static html pages in example.com/wholesale.

    I wanted to be extra sure to not mess up the existing site while I was building the new one, so I installed WordPress in example.com/wp, and set the home page for the new wholesale WP site to example.com/wp as well, while I built the new site behind a “coming soon” page.

    My idea was that when we were ready to launch the wholesale site, I could remove the old HTML files from example.com/wholesale and change the site URL in WordPress to example.com/wholesale. The existing html site would continue to live at example.com.

    Then I could develop the retail section in a staging site, and when that’s ready I could migrate it to example.com/wp and change the site URL to example.com. Well, it sounded like a good plan….

    I tried to launch the wholesale site today and discovered that the first part of the plan doesn’t work, since accessing example.com/wholesale doesn’t launch WordPress (it is still in example.com/wp).

    So instead, I created a redirect in CPanel to redirect example.com/wholesale to example.com/wp. That gets visitors into the WordPress site, but the wholesale home page is still displayed as example.com/wp, and “wp” is used instead of “wholesale” in all the WooCommerce URLs. When I changed the site URL in WordPress to example.com/wholesale, I get a 404 error from the html (parent) site, because there is no HTML page with that name.

    When the project is complete, I’d like to maintain WordPress in example.com/wp, display the new site at example.com, and display the wholesale catalog at example.com/wholesale.

    I have a feeling this can be accomplished by editing the .htaccess file in either (or both) the example.com folder or the example.com/wholesale folder, but I’m unsure what to do. Any suggestions and guidance would be appreciated!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Joy

    (@joyously)

    This link is on the Settings > General page, and explains how you can have WordPress in a subfolder, but controlling the root.

    Giving WordPress Its Own Directory

    That’s not quite what you want, though. The thing you have to understand is that .htaccess files affect the folder they are in, and all their subfolders. So to control the /wholesale folder, your wp folder should be under it, like /wholesale/wp. It doesn’t really work to have the folders as siblings.

    Any time you build a site with a plan for it to control a different folder, you have to fix the URLs in the content. The images should be fine, but any links you use internally would need to be fixed. An easy way is Search Regex, which shows you what will change before you actually change it.

    Your long range plan seems to have multiple WPs? Will the wholesale part be merged with the root part?

    I will assume that you have set things up to have the same URLs as the static HTML (there is a plugin to add .htm if you need it).
    To move forward, I would
    1. put the static files back while you figure it all out
    2. remove the redirect that you added
    3. move the wp folder under the wholesale folder (read the link above)
    4. follow the instructions at the link above for having the wp folder control its parent folder (wholesale)
    5. once you can log in and save permalinks, use the Search Regex plugin to remove the wp folder from any internal link URLs (leave it in the image URLs)
    6. to test, choose one HTML file and delete it. Go to that URL and see if WP generates the page. (That’s how it should work, with same URLs, but if you are doing some sort of redirect to new URLs, then I’d need more information to advise you.)
    7. once the test works, you can delete all the static HTML files in /wholesale, so that WP will then generate those pages

    This WP in a sub-subfolder can control the root of the domain, but it’s not a good idea since you will have the site address as example.com/wholesale and changing that to example.com will change all your URLs. So you either need to plan ahead so you don’t have two WP installations or continue on this path.

    Thread Starter denis24

    (@denis24)

    Thank you so much for your clear and detailed reply. I really appreciate it!

    I spoke with my client and we decided to leave things as they are for now, with WordPress in the example.com/wp folder and “wp” appearing in the URL. It’s only temporary since we plan to launch the retail products in January.

    FYI, I’m not planning separate WordPress installations. I’m using Wholesale Suite to display wholesale prices and restrict some areas of the site to approved wholesale customers.

    Retail products will be in:
    shop/retail-category 1
    shop/retail-category 1

    and wholesale products in:
    shop/wholesale/wholesale-category 1
    shop/wholesale/wholesale-category 2

    (“Wholesale” is a top level product category.)

    When we’re ready to include the retail products, I should be able to set the home page to example.com, leaving WordPress in the /wp folder.

    My problems now came about from trying to launch only the wholesale catalog at example.com/wholesale, while preserving (for now) the existing HTML site at example.com.

    I think your response points me in the right direction on how to accomplish this. If you have any additional suggestions, they would be most welcome!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Need help with site URL, htaccess, redirection’ is closed to new replies.