Joy
(@joyously)
No.
1. Log in to the development WP and use a plugin like Search Regex to change href="mydomain.com/NEW" to href="mydomain.com. Keep the images as is, which would be src="mydomain.com/NEW followed by the path to wp-content.
2. Go to Settings > General and change the SiteURL to mydomain.com.
3. Save Permalinks to regenerate .htaccess and rewrite rules
4. Copy .htaccess to domain root with the caveat that the old one might have redirects or other special handling that you or a plugin added. If so, copy the special stuff to the new one.
5. Edit index.php in domain root and change WEBSITE to NEW.
6. Do whatever you want with the old WEBSITE folder and database.
If you didn’t duplicate the content folder or you want the URLs to images to be like before (with WEBSITE), it would be a little different, but your method does not address the image paths at all.
Hi Joy,
Thanks for your reply.
Wouldn’t your solution mean that the WP url would be mydomain.com/NEW and the SITE url mydomain.com?
I may have omitted to say that what I am looking for, is that when the dev site (NEW) goes live I would like the WP url to be mydomain.com/WEBSITE and the SITE url mydomain.com and the old (WEBSITE) renamed or deleted.
Surely that would solve the image URLs issue also.
Thankfully the site rollout is a few weeks away so no rush for a resolution on this.
I’m waiting to here from my SEO people on whether they would prefer to keep the original image URLs.
I didn’t duplicated the content folder (some new images, different theme, different menu and plugins etc).
Nothing fancy in the .htaccess (I will manually add any 301 page redirects if required).
Joy
(@joyously)
OK, it was difficult to determine whether the WP folder name mattered. In your scenario, you were using WEBSITE but there wasn’t one any more.
I forgot to mention that if the site has posts, the guid in the posts table is used for RSS readers to know if the post has been seen before, so that could be affected by building it at /NEW. Those should be changed to remove /NEW. Pages aren’t part of the feed.
1. Log in to the development WP and use a plugin like Search Regex to change href="mydomain.com/NEW" to href="mydomain.com. Change the images from src="mydomain.com/NEW to src="mydomain.com/WEBSITE".
2. Go to Settings > General and change the SiteURL to mydomain.com and WordPressURL to mydomain.con/WEBSITE.
3. Rename WEBSITE folder to OLD.
4. Rename NEW folder to WEBSITE.
5. Log in and save Permalinks to regenerate .htaccess and rewrite rules.
6. Do whatever with OLD folder and database.
If I do search regex in search only mode for href="mydomain.com/NEW" and src="mydomain.com/NEW I get “No more matching results found.“
Joy
(@joyously)
That’s good. It indicates you already changed them, or you never had any internal references in your content (although you said you had some images). Hopefully, you used the full URL, starting with http, when you searched.
I didn’t do anything!
I only used search mode, not search and replace.
I tried a different approach which seems to have worked.
- Log out of all WP dashboards.
- In cpanel file manager, rename the original
WEBSITE to RANDOM-NAME or delete it.
- In phpMyAdmin select the database for
NEW and select “wp_options” table and change “siteurl” and “home” to mydomain.com/WEBSITE.
- In cpanel file manager, rename
NEW to WEBSITE.
- In cpanel file manager, edit “.htaccess” in the newly renamed
WEBSITE folder and change RewriteRule . /NEW/index.php [L] to RewriteRule . /WEBSITE/index.php [L]
- Go to mydomain.com/WEBSITE/wp-admin and login with credentials for
NEW.
Then do the move WP from directory to root – https://www.webhostinghub.com/help/learn/wordpress/running-wordpress-from-a-subdomain-or-subdirectory
Voila – I now have the NEW WordPress site in a folder named WEBSITE viewable from mydomain.com
The only downside was that there were more than 30 references to NEW still in the database.
I’m not an SQL guru so it took me around an hour to manually edit all those out in phpMyAdmin.
There are only 5 pages/posts on the development site for now but the final site will have nearly 50 pages/posts. That’s a long time to spend in phpMyAdmin manually editing.
One other issue was with a photo slider plugin that I had to reset.
-
This reply was modified 5 years, 2 months ago by
grey4radar.