hollyvalero

Relative vs Root link paths - How to update after a DNS change

Recommended Posts

I have a website on a shared server that I use to store a few sites. My active domain is at the top.  The new website domain hasn't been activated yet, but the path would be something like:  myactivedomain.com/newdomain.com/ and once the DNS is flipped, just newdomain.com/

As I am building and adding a load of PDFs, all the links default to /newdomain.com/site/assets/files/etc...

This isn't migration, but a DNS activation.  Once that is updated, I'm still going to have a bunch of /newdomain.com/ links in there to pages, pdfs, images, etc. 

Before I resign myself to grepping out page-by-page all the "/newdomain.com/" references I thought I would see if there's a way to update these automatically in processwire but I'm seeing stuff on migration... stuff in the rich editors about correcting links, but I don't see anything that covers this.  Is there a way to do this automatically? Via module? I didn't see anything in the config file... but would be grateful to anyone who can shed some light... 

 

Share this post


Link to post
Share on other sites

Does your hoster allow domains to point to that subfolder directly (without having it bought)?

If so, enable that and use your local hosts file on your computer to have newdomain.com point to your hosters IP. This way you can develop with the new domain even without the public dns present and without your subfolder in urls.

Otherwise try to point a subdomain of your active domain to that folder because changes of (sub)domain -> domain are far easier to pull of than subfolder -> no subfolder. The biggest (if not only) issue here being rich content editor entries. Most other things in processwire are relative anyways.

Additionally if your hoster cannot map domains directly to your subfolder you'd need some additional .htaccess in your root folder to forward requests of your new domain to your subfolder.

Share this post


Link to post
Share on other sites
8 hours ago, LostKobrakai said:

Does your hoster allow domains to point to that subfolder directly (without having it bought)?

If so, enable that and use your local hosts file on your computer to have newdomain.com point to your hosters IP. This way you can develop with the new domain even without the public dns present and without your subfolder in urls.

Otherwise try to point a subdomain of your active domain to that folder because changes of (sub)domain -> domain are far easier to pull of than subfolder -> no subfolder. The biggest (if not only) issue here being rich content editor entries. Most other things in processwire are relative anyways.

Additionally if your hoster cannot map domains directly to your subfolder you'd need some additional .htaccess in your root folder to forward requests of your new domain to your subfolder.

Yeah, trying to avoid further obfuscating DNS stuff, since that's the kind of thing that inevitably falls through the cracks later... no one remembers... the site grows big...  It's not a huge site and grepping out all the paths will not take more than maybe an hour or two... I think.  I'd rather do it now, before it gets bigger...  Just wondered if there was a way to establish the root path within processwire.  

This is also helpful for developing a new site at an existing server... you'd want to build in a separate directory and move it up one while the current site is live and uncompromised.  It's an administrative detail that always pops up in redesign.  It would be the kind of thing that -- if it was part of Export Site Profile? Well, that would take care of it... if you could say "reset root path to..." with a domain name or domain.com/directory/path ...

 

 

 

 

Share this post


Link to post
Share on other sites

^^ btw, I did come up with an idea that would work... for websites that are either redesigns or brand new, I've designated an unused domain, activated it, and that will allow me to build at a .com address, export the site profile, and import it to another root level address.   An addition to export site profile would be ideal, but this will work in the meantime...

Share this post


Link to post
Share on other sites

Simply try to develop in an environment, where your site is accessed without subfolders in your url (or with the correct one if it'll later live under a subfolder). The domain itself does not matter that much because ProcessWire does not add it anywhere without you actively requesting it. That's why I suggested a simple subdomain of some domain you already own.

  • Like 2

Share this post


Link to post
Share on other sites
7 hours ago, LostKobrakai said:

Simply try to develop in an environment, where your site is accessed without subfolders in your url (or with the correct one if it'll later live under a subfolder). The domain itself does not matter that much because ProcessWire does not add it anywhere without you actively requesting it. That's why I suggested a simple subdomain of some domain you already own.

Yeah, I think you're right. Just need to mimic the final destination... domain or subdomain for those that will be at the root.  Or, identical folder name for those that will be in a subdirectory.  

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By holmescreek
      Summary: If I have a site sitting on a server called testing.com, then on the server change it to mycompany.com, do I have to modify any settings in ProcessWire?
      After building several processwire for clients, the one question that I haven't had is about moving a processwire site from an old (temporary) domain to a new domain.
      For instance, I typically setup development sites for clients and register a temporary domain (and lock with a password). For instance, thee client can go test.com and get all their content finalized, change wording, add news, swap out photos -- everything to make the site production read.  
      Next, on my hosting account I can have testing.com renamed to theircompany.com - and change the nameservers.
      A simple question here. If I have a hosting company rename the account from testing.com to theircompany.com, change my nameservers whereas going to theircompany.com loads the production site, Is there anything I need to change in the processwire configuration or in the PW database?
      In the past, I've just manually copied the site, and fresh-installed PW, and imported the data. Seems like a lot of hassle.
      I have a second part question about updating the PW core, however, after consideration I'll post it as a new topic.
    • By Cole
      Long time listener, first time caller...

      I have been working with ProcessWire for some time now and it has been amazing, my go to CMS. Previously my workflow had a local development setup through MAMP using an address like http://localhost:8888/websites/example.com.
      I have recently changed this in preference of  http://dev.example.com, that way I do not need to disable the .htaccess forward from non-www to www to develop locally. My .htaccess forward is setup like:

        RewriteCond %{HTTP_HOST} !^dev\. [NC]
        RewriteCond %{HTTP_HOST} !^www\. [NC]
        RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
      This works on all sites that are still using ProcessWire 2.5, however on sites using 2.8 and 3.0 I am getting a 403 Forbidden error. After reading through the forum posts related to 403 errors I have not been successful in finding a solution for my issue. Has anyone experienced this or can assist? Thank you very much in advance, the forum community has been so helpful I have never needed to post until now.
    • By quickjeff
      Hi Guys, 
      I wanted to reach to everyone in the community to see if someone has come across this issue. 
      We have a client that had a website built in PHP. 
      We provided our client with a new website built on ProcessWire.
      Our client has their domain name registered  with register.com and their old website was built by another developer who was hosting the website in a virtual server at gandi.net.  
      The DNS settings were as follows:
      Domain name was pointed to the gandi.net in order to display the website files. 
      The MX records were pointed to Google servers for company emails. 
      The Name servers were as is which is the stock register.com name servers.
      We were not able to speak with the old developer to setup a time to update the files so we were asked by our client to move forward without contacting the old developer.
      How we setup the new website:
      In order to avoid down time of the email accounts and not having to setup new MX records on another host, we simply setup our clients new website on GoDaddy shared hosting and changed the A record in their register.com DNS settings to point to the new hosting account. Basically, an IP change. Everything else they had stayed the same, meaning we did not change the MX records and we did not change the name servers.
      Here is the issue:
      Some website visitors are seeing the new website, some are seeing the old website.  We first thought it was due to browser caching or the propagation did not fully complete when they tried to visit the website.  After telling our client to wait until the new DNS settings or try to clear their cache, we thought they were all good to go. 
      Now our client is contacting us saying that the issue is still happening. So we contacted register.com and had them resubmit the new DNS settings again, basically the same IP change we did.  
      Result:
      Some users are still seeing the old website on certain routers. We are also seeing the old website on certain routers we use and the new site on other routers. 
      Can anyone provide some guidance? Has anyone seen this issue before?
      We even pinged the website and it shows the correct server, we also used whatsmydns.net to see what the site is coming up as across the world and we also see the correct server. Lastly, we sent the url to our partners in Germany and they see the new website and not the old one. 
      This is honestly the oddest issue I have seen and unsure as to why this is going on?
      Here is our clients site:
      medstarlab.com
    • By Peter Knight
      Hi guys
      I'm running PW on a VPS on Plesk for the first time and having some problems. The DNS hasn't yet kicked in so I have a funky IP address, port number and webspace name in the URL which aren't helping.
      I've obscured the real address here but you get the picture
      https://111.111.111.111:8443/sitepreview/http/mydomain.com/processwire/
      I can load up the login page but the css isn't mapping correctly and looks like

      Is it the htaccess I need to edit by changing 
        #   RewriteBase /
      to
      RewriteBase /sitepreview/http/mydomain.com/
      or something else? Currently above doesn't work.
      If I look at the source, the css is mapped as follows:
      <link type='text/css' href='/wire/modules/AdminTheme/AdminThemeDefault/styles/main-classic.css?v=12' rel='stylesheet' /> <link type='text/css' href='/wire/modules/Process/ProcessLogin/ProcessLogin.css?v=101' rel='stylesheet' /> <link type='text/css' href='/wire/templates-admin/styles/font-awesome/css/font-awesome.min.css?v=12' rel='stylesheet' /> <script type='text/javascript' src='/wire/modules/Jquery/JqueryCore/JqueryCore.js?v=183'></script> <script type='text/javascript' src='/wire/modules/Jquery/JqueryUI/JqueryUI.js?v=193'></script> <script type='text/javascript' src='/wire/templates-admin/scripts/inputfields.js?v=12'></script> <script type='text/javascript' src='/wire/modules/AdminTheme/AdminThemeDefault/scripts/main.js?v=12'></script>