-
Notifications
You must be signed in to change notification settings - Fork 1
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
Allow www.domain.com and domain.com #2
Comments
Thanks for the report, Josh. It's actually known problem and one I'm not sure of what to do with. I am using a patched plugin for this problem on one site, but in general I would consider it the devs' job to properly force www or no-www through htaccess or similar. My patch actually writes the www. version to the context cache file as well (essentially creates two items per context). So the question is... do we want to force both to work, or tell the dev to make sure to pick whatever works best. |
I guess I would recommend looking at this as 2 separate issues.
I would think most people would want #1 to always work and then there are some that want #2. To make things easier, if MODX could do both 1 & 2. We are on IIS and htaccess does not work and I not sure how to make many domains go to www or no www that points to the same files. |
There's now a system setting includeWww to toggle this behavior. It defaults to on. |
Awesome! |
I have several domains on single MODX Revolution install. And someone noticed last week that the "www" was not working. I set the http_host of the context to domain.com. Unless I missed something, with the way the plugin works I need to create another context to have the www.
Here is a simple work around I did to get this to work, it would go around line 35:
$whost = substr($host,4); // ADDED
if (array_key_exists($host, $contexts)) {
$modx->switchContext($contexts[$host]);
} else if (array_key_exists($whost, $contexts)) { // ADDED the else if
$modx->switchContext($contexts[$whost]);
}
Forgive me for being lazy and not doing a pull request.
Thanks!
The text was updated successfully, but these errors were encountered: