Link to home
Start Free TrialLog in
Avatar of ivolach
ivolach

asked on

How to keep the redirecting URL when it is being redirected to a diferent WordPress site

I have created a wordpress site on a subdomain 'wpsite.domaina.com and I have redirected www.wpsite.com to 'wpsite.domaina.com.

The redirect works OK but once the user is redirected, the URL on the page changes to wpsite.domaina.com

How can I mask the actual URL with the original URL so the user is not aware of the subdomain?
Avatar of Coy Melancon
Coy Melancon

You changed both the home and site URL in wordpress settings?
Avatar of David Favor
By doing a redirect, whatever the target of the redirect - wpsite.domaina.com - will show up in your visitor's browser.

This is how redirects work.

Normally you'd use a different approach, if you require some other URL to show up for visitors.
Avatar of ivolach

ASKER

When I change the home and site URL in wordexpress it stops working
I think you're still missing how this works.

If you're WordPress site is accessible via wpsite.domaina.com then to change this to wpsite.com you must do several things.

1) The Webserver running on the wpsite.domaina.com IP must be configured to serve content for the wpsite.com domain.

2) Part of this config will be pointing wpsite.com to the WordPress install (where .php files live) for your wpsite.domaina.com domain.

3) Once this is working you must mass edit (rewrite) all database records, changing wpsite.domaina.com to wpsite.com in both serialized + non-serialized data.

When I do this for clients, it's a single wp-cli command line action...

wp search-replace "wpsite.domaina.com" "wpsite.com" --precise --recurse-objects --all-tables

Open in new window


If you have no command line action, likely the smoothest way for you to accomplish this is to use a backup plugin, which handles database URL rewriting as part of it's restore process. So you do a full backup your site (database + .php files) with a plugin. Then destroy your site, database + all .php files. Then restore your site, which will have wpsite.com throughout database, after restore rewrite occurs.

https://wordpress.org/plugins/duplicator/ tends to be the backup plugin I use, when I have no command line access to a client site.
Avatar of ivolach

ASKER

This is a little too complicated for me and I am afraid to break my whole install.
Right now I have this setup:

domaina.com is serving a joomla site
wpsite.com is redirecting to wpsite.domaina.com which is serving the WP site.

Everything is working ok, except that once the WP site is running, the URL on the address bar is showing wpsite.domaina.com

I am trying to mask the wpsite.domain.com with wpsite.com, but if it gets too complicated I'll live with the current settings.

Thanks,
Based on your questions, I think you may be correctly concerned about breaking your sites.

Likely good for you  to open a Gig with someone who does this type of work every day.

As there are just so many variables that can come up. Best to have a Pro help you with this.
If you use real URLs, then someone might be able to assist you.
Avatar of ivolach

ASKER

Thanks
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.