Forwarded domains & changing URL links within a site

Hello. I have a client forwarding and masking their domain to a WP site I've developed on another host server. The URL window successfully masks my domain name, replacing it with my clients domain on the home index page. However, once a link is clicked the domain name in the URL window reverts back to my domain name. But, I want the domain name to stay the same as my client's forwarded domain for all links within the site.

So, is there an optimal way (or plugin maybe) that could manage this?

Is there an ideal way to manage domain names (siteurl and home) in order to develop a WP site within one's own separately hosted domain, while having a site function properly in both ongoing development and live viewing from a client's forwarding domain name? Again, with all links within the site staying the same as a client's domain, which would be different from the domain name my site is actually being hosted and developed on?

I'm really at a loss where to begin.

Thanks much,

Mike

  • Arun Basil Lal

    Hey Mike,

    I get what you are trying to do, but I wonder why you are doing it this way. So in short you will be developing a site on your own domain and then the client forwards his domain to yours (as masked) and then you want all the links to be masked with the clients domain right?

    Why not just change the Name Server of your clients domain and make it point to your host and replace your domain with the cleints domain on your host? You just need to change the site url and blog url settings to the new domain in the WordPress Settings > General area and that should be it.

    Don't you think?

  • gatsby

    Hi, Arun. Thank you for your reply.

    What you have stated in your first paragraph is indeed what I need to achieve. I don't know if it's the best method, however it's what my client has requested. To clarify, this particular client is requesting that I develop several social hubs that integrate into several of my client's pre-existing subsidiary company websites. Since each of my client's company sites already has the directory that my social hubs would be viewed on live (ex. whatever.com/socialhub) and in use for years, they need to have the server admin make a quick forward/mask when ready, and have my newly developed site suddenly appear within each company's website. I've added my clients domain to my host and linked my domain with the client's domain via symlinks (an SSH solution for forwarding), however my client has not activated forwarding yet.

    1. That all said, are you saying that I should simply be able to change the domain name to my clients within the WP settings dashboard, once my client points their domain, and after doing so I should be able to develop as normal, only difference being that my LOGIN domain would change to my client's domain?

    2. There is no danger of breaking any links that will require time to fix?

    3. Should I change BOTH the home and siteURL to my clients domain name?

    4. How can I log back in to change the settings when my client is not actively forwarding their domain to mine?

    I thought this might indeed be easier than I thought, however I have not experimented, since I'm concerned about potentially breaking links or creating hard to fix issues (the first site I've already developed completely and has hundreds of posts within it). I wanted to consult a trusted expert like yourself before I proceed.

    Thanks much,

    Mike

  • Arun Basil Lal

    Hey there,

    I hope you should be able to get on with Moha's solution, what I suggested would work as long as you are dealing with the root domain. Like if you had a clientdomain.com for the live site and the productiondomain.com for the site that you are working on and when its all done and the client approves the work, you can simply change the productiondomain.com with the clientdomain.com and everything would work, including the links and images :slight_smile:

    Cheers!

  • gatsby

    Thank you for your replies.

    1. Regarding Moha's solution, my client already has a forwarding and masking solution on their end, which again, works for forwarding and masking the home URL window to show as my client's URL. I'm concerned the mod_proxy method might interfere with my client's forwarding solution thus far or create issues that really are more the realm of a Server Admin, not a Web Developer. Moreover, MediaTemple has made it clear that they could not remedy masking links within the production site, and that I had to seek a WordPress specific solution. With that, could you elaborate please, Moha?

    2. I'm more inclined to utilize a solution like what Arun is offering. Arun, if I use that method after my client's forwarding is enabled, can I log-in to the WP dashboard once my client's forwarding solution is live? Would I be logging in as clientdomain.com/wp-login.php? And, should I change both Wordpress Address and Site Address to my client's domain name (in general settings)? What if I just changed Site Address?

  • Arun Basil Lal

    Hey there,

    So if I get it right, you want clientdomain.com to stay the same and clientdomain.com/socialhub to be pointing to the new site that you are working on, right?

    In that case, my solution wouldn't work.

    Mine will work if you wanted to have the socialhub on clientdomain.com

    The Site Address and WordPress Address need to be the same in most cases. The WordPress address should be where you have the WordPress files and the site address can be different. Its often used when you want to keep WordPress in a directory and want to have the site showing up as a different url.

    Like in this setup: http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

    Let me get in touch with Moha regarding his method..

  • Arun Basil Lal

    Okay, is there a chance that you could send us the real links? Moha would like to figure what sort of cloaking your client uses. You can email that via our contact form: https://premium.wpmudev.org/contact

    (Please include a link to this thread, and title it "Attention: Moha / Arun")

    One more question. Once it is done, will the public be accessing the site on your server? Or can it be from the clients server? If it can be from the clients server, you can simply move over the whole setup there and save all the trouble.

    Let me know.

  • gatsby

    Thanks for this very helpful reply, Arun. It's much appreciated. The public will indeed be accessing the site via my host server at Media Temple. The client is only forwarding/masking. You raise a good point about moving the site to my client's server, however there are evidently obstacles preventing that, and this client requested this forwarding arrangement.

    I will email that information via contact right now, and include the link and title...

  • Arun Basil Lal

    Hey there,

    Thanks for sending over the stuff. So I believe you have the forwarding or masking from the clientdomain.coim/blog to yournewdomain.com/blog ? (sorry if I am a bit confused here, I really am).

    If so set your WordPress address as clientdomain.com/blog and that should work out I believe.

    like when a user visits clientdomain.com/blog he will be taken to the new hosting (via your forwarding). The url will appear the same and things should work out.

    I hope that makes sense..

  • gatsby

    So, the forwarding and masking would first need to be enabled by the client I assume? Then your solution would work?

    Actually, this doesn't make sense to me, since this seems to be conflicting with previous advice. And, you're saying just change the WordPress address, however if the WordPress address is where the core files are located, this solution doesn't follow logically, since the core files are on my host domain, not the client's host domain, as I've detailed previously. What am I missing here? Thanks.

  • gatsby

    Hi, Arun. I would have shared my solution earlier, however I had not slept in over 24 hours when I wrote my last message, to save you any trouble on further research.

    My solution: First of all, one needs a good proxy forwarding solution. On my server I linked up my client's domain (on a different host) with a domain on my MediaTemple hosting. MediaTemple offers symlinks, which is an SSH solution for Linux, which links up any domains one wants to associate for forwarding. Once that was completed with just a few short command lines, forwarding with masking was successful, HOWEVER only for the home page.

    In order to take have a forwarded domain display it's domain name in the URL window for ALL links withing a site, WP has be set in the wp-config.php file via FTP. It turns out that a very simple solution was needed to finalize masking all links, which you did mention, though not with such clarity as specifying doing so via wp-config.php and ftp:

    define('WP_HOME','http://example.com/blog' );
    define('WP_SITEURL','http://example.com/blog' );

    And, it's worth noting the my client's proxy solution required www, so it actuallly looked like this:

    define('WP_HOME','http://www.example.com/blog' );
    define('WP_SITEURL','http://www,example.com/blog' );

    Now there may be other solutions, but I can guarantee that the above worked 100% for me. Hope that helps someone in the future, as I'm certain many developers must also develop and host sites on separate servers, which can be accessed to go live by ANY client's URL from ANY server. Really an elegant solution.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.