Wordpress Custom Domain redirects to old Generated Domain

quickstarkHOBBY

a year ago

I was trying to use a custom subdomain (dev.unicusathletics.com) which appears to register fine in Railway console, but visiting that URL redirects to the old generated domain (https://wordpress-production-4c64.up.railway.app/).

The bigger problem is whether using the custom domain or reverting to an auto-generated domain, I can no longer access my WP site (and have content there I need). Just get the "Nothing Here Yet" message regardless of how I attempt to access it http/https.

Wondering if this is because the WP baseurl no longer matches, but no way (that I know of) to access the wpconfig file to modify it. Any help appreciated.

19 Replies

a year ago

hey quickstark,

was the WP working before? where was it running before Railway? Are you deploying WP using a template?


a year ago

have you since redeployed the wordpress service after adding the custom domain?


quickstarkHOBBY

a year ago

Some answers

  1. Was WP working before - yes, before the domain update, it was working fine

  2. WP was deployed via the Railway template (Dockerfile)

  3. I've redeployed and restarted multiple times including reverting "auto-generated" domain and re-registering the custom domain; the same behavior


a year ago

is deploying WordPress again, but setting the custom domain before you run through the setup and option?


quickstarkHOBBY

a year ago

I believe I’ve tried every combination of domain setting and redeploys. I’ve even tried setting it to the original domain. No dice.


a year ago

sorry, i should have been more clear, I meant deploying a fresh Wordpress template, and then add your custom domain before you run the setup


quickstarkHOBBY

a year ago

Will probably try that next … need to export the MySql to preserve the content


quickstarkHOBBY

a year ago

Deployed a brand new Wordpress template, updated the domain and even the new one points back to the original generated domain. This feels like a potential bug.


a year ago

did you add the custom domain before starting the setup? and did you start the setup wile visiting from the custom domain?


quickstarkHOBBY

a year ago

Added before I touched the URL … seems like they all point back to the original URL generated when deploying the 1st WP template.


a year ago

I could reproduce the incorrect redirects, added this service variable, and am no longer being incorrectly redirected.

WORDPRESS_CONFIG_EXTRA=define('WP_HOME','https://${{RAILWAY_PUBLIC_DOMAIN}}');define('WP_SITEURL','https://${{RAILWAY_PUBLIC_DOMAIN}}');define('DOMAIN_CURRENT_SITE','${{RAILWAY_PUBLIC_DOMAIN}}');

quickstarkHOBBY

a year ago

I am continuing to work on this, but still facing issues with "Not Found". The extra environment variable is semi-successful for me. It kind of redirects, but can't log in and the Theme info is missing. Seems related to the base_url.

Backed up MySQL DB and restored to a new WP Template. Exact same issues.

Feels unpredictable / buggy / broken to me. Shouldn't be this difficult.

Going to move this to a more reliable solution, but unclear if all the content and design edits can be salvaged.


a year ago

really sorry you're getting so blocked on this. very frustrating.

just to confirm: you are using this template?
https://railway.app/template/EP4wIt

I'll see if I can deploy it


a year ago

I too am just about to do some more digging on this issue


quickstarkHOBBY

a year ago

I bumped up to a Pro plan to ask support for an assist


quickstarkHOBBY

a year ago

Re. the template, using https://railway.app/template/5zlUaZ as I prefer MySql (though really doesn't matter)

I suspect the problem is related to WP's need for the base_url to be set properly in wp-config and on the associated posts, but AFAIK, there's no mechanism to modify that without SSH'ing in to modify that file. The extra ENV variable (above) sort of works (the old site a semi-available), but all the theme info is gone and the wp-admin / login is inaccessible.

I would've thought reverting to the original auto-generated domain would resolve this, but didn't help. Feels like I'm missing something simple here, but unsure what that may be.


a year ago

Just noticed that the form has very incorrectly formatted that environment variable above, instead, copy from here https://gist.github.com/brody192/d5c130581f8ace1ee82d1fb6e846bed3

This does indeed work with Jack's template, as once logged in I see that WordPress Address (URL) and Site Address (URL) are set to the custom domain.

Jack's template uses the official WordPress docker image, the template you linked is outdated and does not use the official docker image, I would recommend against using it.


quickstarkHOBBY

a year ago

Update. Testing, but the revised ENV variable may have fixed this for both domains (auto-gen & custom). 🤞

Thanks for helping triage this … wish there was a link or note re. the WP ENV variable.


a year ago

happy to help