Would appreciate any assistance of how to handle configurable URLs for each environment.

The links need to take the user to a different URL depending on the environment the site is installed in. In test environment, they would go to the test site, in beta test environment, beta site. And in production, production.

Currently I am calling the test url by h ref in the body text. However, when the site is moved to beta, I would have to manually change the url to the beta url and so forth. I have about 50 of these type of URLs throughout my site so I am looking for a automated way.

I have thought about using

https://www.drupal.org/project/scanner
https://www.drupal.org/node/257026#example-use-cases

But open to any suggestions or experience.

Many thanks in advance!

Mike

Comments

VM’s picture

I like many use three separate local addresses to avoid the exact issue you are going to run into.

The site is essentially always in -dev and -staging as tweaks move through their progression toward production.

localhost/dev
localhost/staging
localhost/production

mike1990’s picture

There are three unique domains for the drupal site for dev, staging, and production.

VM’s picture

ok. Drupal is relative to its' index.php file which is in its root. Therefore nothing should break between environments based on urls.

ok, i better understand now. It's because you are hard coding into a field for some reason unmentioned.

mike1990’s picture

I hard coded them into the body content because it is easier to access to change. Overall, my drupal site has 3 unique domains ( 1 for dev, 1 for beta, and 1 for production). The drupal site has a few blocks that have either links or buttons that will redirect to .net sites. These .net sites also have specific urls ( 1 for dev, 1 for beta, and 1 for production). Currently I am calling just the dev urls throughout the site but I am trying to automate so that when the drupal site is in beta environment, all my .net urls will point to there beta urls. I can manually change the urls bc there are in the body content but I have about 50 urls to do that for so I want to automate this.

VM’s picture