-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamically set WP_HOME and WP_SITEURL #224
Comments
Nah, we won't be adding this to bedrock, but you can do this in your Add this to your
|
Oh nice. Didn't know I could do it that way. Curious on why you're against it though? Anything I'm missing that it breaks? |
In production, it can result in duplicate content "penalties" since WP_HOME constant is used to determine canonical URLs, e.g., both www and non-www URLs to a post will be "canonical," and if you have any aliases for your domain, then they're canonical as well. Plus I suspect it would take a giant shit all over multisite setups with subdomains. lol |
What about HTTPS? Also, while it might be ok for development, it's probably not a great idea for production. You wouldn't want to assume that PHP's global vars are always 100% correct, I wouldn't want to rely on it for something so integral when it's an easy fix to set it as an env var. And unfortunately, your case is a little edge case, it's the first time I've heard of someone using PHP's built in server for any extended period of time. Most people use Vagrant or some other local server set up |
Gotcha, thanks for the added insight! 👍 |
Have you considered setting the
WP_HOME
andWP_SITEURL
's dynamically?For instance, adding the following to the config file and removing the corresponding entries from the
.env
file.This would allow for an install that isn't dependent on a consistent hostname and making local development a bit easier. In my case, I run my local sites with the built-in PHP web server with a random port number each time to prevent conflicts from multiple instances running.
The text was updated successfully, but these errors were encountered: