Default domain and local development

Hello,

fairly new to Kirby, so excuse me if this is actually not that smart of a question :wink:

I’m hosting on Uberspace, so the site is also reachable with at least one more domain (username.uber.space). That means the canonical url for the main domain is crucial to me to avoid duplicate content with Google. To achieve this, I have url => mydomain.com in the config and it’s working fine.

The only thing that has become harder is local development. While I have most of the urls that I manually enter as relative, the automatically fetched (like e.g. for blog posts) have absolute urls that point to the main (live) domain and not the local dev platform. To prevent this, every time I’m doing local development I’m removing the url from the config for the time being. Is there something I’m doing wrong or some way I can easily upgrade my local workflow to optimize this?

If not, that’s totally ok. Was just wondering if I can save some time in the future :smile:

You can use different config files per domain, so instead of putting the url into the main config, just put it into config.mydomain.com.php instead.

1 Like

Thanks, never thought of searching for environment, but makes perfect sense :smile:

Additional question: while this works for the live domain, config.localhost.php doesn’t seem to get triggered for my localhost:8888 local dev domain. Shouldn’t config.localhost.php work for my localhost, or does it need to be named something else? Not using it right now, but maybe for the future may need an additional environment…

Yes, it should work. What exactly did you put in there to test?