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
includeDynamic on multiple sites with a subfolder (site.com/myLanguage) may be broken #562
Comments
Does your web server run nginx or Apache, and can you please show me the location block or rewrite rule used, respectively? |
Thanks for the reply @bencroker Nginx. You can easily reproduce it using the craftcms/nginx docker image. But here's an example from staging server:
|
I would think that the final rule, |
Are you trying to reach the URL with the subfolder at the end? I see no reason why it should fall to the "/" location. Can't you just use the controller URL(without index.php) like you do for getTemplate? I believe this should solve the problem |
This is due to how
Can you please confirm that you’re using the
This would work but also breaks other parts of the system. |
Yes, I confirm that I use this statement.
I understand it. I may be wrong, but as far as I know, the request for /en/index.php does not match the "location/" conditions, since in this case we are requesting the exact file in a specific folder, and since there is no such route. it will be 404. https://putyourlightson.com/index.php 200
Okay, then it looks like I can only add another location rule for this case so that I can catch the location of /subfolder/index.php. Something like this?
|
One of the You shouldn’t need to be doing this, though, and I plan on fixing it at the code level. It may be as simple as 4151114 but I’ll need to do some further testing. In the meantime, can you please see if that change solves the issue for you? |
Thanks Ben. Yes, this change solves the problem for me: |
That’s good to hear, thanks for testing! I’ll do some more testing on my end and, if all goes well, will add this to the next release. |
Chiming in to just confirm that I ran into this too and reverting to |
Thanks for that @abigailjxn, I'm working on a fix to resolve this as well as the issue that was originally solved, without inadvertently introducing a regression bug. |
This should be fixed in 340264d. You can test this by running |
Released in 4.6.0. |
I ran into a weird issue after switching from
getTemplate
toincludeDynamic
tag.When using
getTemplate
everything was fine, but after switching toincludeDynamic
, all the includes just fall off with a 404 error.So I decided to check what the problem, because for other sites it worked well.
After some research, I realized that the included URL was prefixed with a currentSite prefix:
So instead of
site.com/index.php?action=blitz..
. it wassite.com/en/index.php?action=blitz...
And as I have only one index.php in the web folder(without any prefixes), all dynamic requests turn into broken.craft_folder/web/index.php
And I don't have
craft_folder/web/en/index.php
I understand that I can create, for example, an
en
folder in theweb
directory and add index.php there, but isn't there a more elegant solution. Is it possible to add some option in config/somewhere else to not include the current site URL and use root/baseUrl?Or what can I do to fix this without creating any folders with another index.php?
The text was updated successfully, but these errors were encountered: