Jump to content

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


hollyvalero
 Share

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... 

 

Link to comment
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.

Link to comment
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 ...

 

 

 

 

Link to comment
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...

Link to comment
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
Link to comment
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.  

Link to comment
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
 Share

×
×
  • Create New...