SIteCore - multisite - displaying page from wrong site - sitecore

We have a multisite SiteCore setup with 2 sites within the same .Net solution.
This works by setting the rootPath property on a Site Definition in web.config to limit the site to part of the SiteCore folder structure.
This works well apart from when pages are created with the same name as in the other site then it's serving content from the other site! We have inherited a fair bit of custom code in this solution form the other site so this may be the cause but dont know what Im looking for ...
Thanks

How are you referencing the sites? Do they each have their own host name? Do you have the "hostName" property set for the site node in the Site Defintion?
I will assume that you are not referring to them this way and instead, the sites are using the "virtualFolder" property. If both sites have the same default value of "/" for virtualFolder, attempting to get to either site will result in Sitecore rendering the first site that it matches on, which would be the site listed first.
Try putting the actual site name for "virtualFolder" and "physicalFolder" (e.g. "Site1" and "Site2", respectively). Then you can address your sites as http://yourserver.com/Site1 and http://yourserver.com/Site2. The "virtualFolder" will match first and render the correct site.
See Configuring Sites in the web.config File on SDN for additional information.
Hope this helps.

It turns out this is happening in this case because of a System alias that is redirecting for a subset of pages

Related

django redirect to subdomain with exact same url

I have a Django website accessible at codewithbishal.com. This is basically a django blog website and all the blog articles are accessible at codewithbishal.com/example/<path>
But now I want to completely restructure the website{such that it is accessible at blog.codewithbishal.com/<path>} and I do no want to lose the current SEO therefore I want to configure django redirect such that when someone launches codewithbishal.com/example/<path> through google search search result or directly through link, they are redirected to blog.codewithbishal.com/<path> instead of a 404 page and eventually google will start showing the new links instead of old once.
Update: Should I configure redirect through apache .htaccess?
You can use the Django redirects app. Just click the link and find the guide.

Sitecore Homepage Shows Error Message, but is viewable at different URL

In my sitecore instance, (8.2 rev 170407), I'm having an issue viewing the homepage in both my dev enviroment and my staging server. Going to the homepage (the root of the server) redirects to this URL
http://[website]/sitecore/service/nolayout.aspx?item=%2f&layout=%7b00000000-0000-0000-0000-000000000000%7d&device=Default
The message says:
The resource you are looking for (or one of its dependencies) may have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Additional Information:
Requested URL: /
Requested Layout: {00000000-0000-0000-0000-000000000000}
Requested Device: Default
In testing this, I set the Home item to have an alias of /home, which I can visit and see the page looking fine.
This issue began when I set up Helix via the Yeoman script, and built it in VS2015. This is my first Sitecore Site so I handily accept that I made a mistake -- for example when I built the Solution for the first time it overwrote my Web.config. I had a backup of that Web.config and was able to bring the site back online but the Homepage has eluded me.
I've published, and republished. In my naive experience, I find it odd I can see the homepage at /home but not /. Any advice is appreciated, thanks.

Django Wagtail pageurl template tag returning incorrect host name

I'm using Wagtail 1.8 and the pageurl template tag on a blog index page to hyperlink the titles of the blogs through to the actual blog pages. Pretty standard stuff. This is a Django 1.10 project.
<a class="blog-post-link" href="{% pageurl blog %}">
<h2>{{ blog.title }}</h2>
</a>
The very strange problem I'm having is that the host name of the site is being replaced by the host name of my server that is hosting the site. For example, a correct link would be:
https://beadtrails.com/blog/vernon-bc-what-to-do-on-and-off-the-trails/
However, it is sometime being returned as https://graphicearth.ca/blog/vernon-bc-what-to-do-on-and-off-the-trails/
When I say sometimes, if I go to the wagtail admin sites page, then into the host record and save it, it will fix the problem--for a while. It will then revert back to the incorrect url.
As you can imagine, this is not a great situation where your blog links end in a 404 error!
For trouble shooting, I've checked the config of both Wagtail and Django sites tables, checked the config files correctly identify the SITE_ID, done a text search through all the source code for 'graphicearth.ca', reviewed the uWSGI and nginx config files, checked that the blog hierarchy is correct within Wagtail relative to the home page, checked the headers in the browser to make sure the right host is being passed. Everything looks ok.
Digging into the source code for the template tag, which is in wagtailcore_tags.py, the comments for the function says:
Outputs a page's URL as relative (/foo/bar/) if it's within the same
site as the current page, or absolute (http://example.com/foo/bar/) if
not.
So for some reason, the code ends up thinking that the sites are different--but not all the time. As mentioned above, if I go into the Wagtail admin and re-save the sites entry it fixes things for a while.
As this is on a production system, it's rather hard to debug. Does anyone have any suggestions on what might be causing this and/or how to debug it?
Application stack is:
- Django 1.10.5
- Wagtail 1.8
- uWSGI
- nginx
Answer update:
Tom's response was what led me to find the solution so I've marked his answer as correct. I was using the same memcached instance for multiple sites and the keys must of been getting crossed. I reverted to basic django cache and it resolved the problem. Time to find a better solution for caching with multiple sites on the same server.
Do you have a cache configured on the production system? The pageurl template tag calls get_site_root_paths() which uses a cache of site root paths if one is available. The cache should be purged if sites are edited or deleted, but perhaps you could try configuring settings.CACHES to use DummyCache to help track down the issue.

Can't Open Web forms for marketers Form Designer or Security Manager

I have had WFFM running on a Sitecore instance for a while, but it has recently stopped working. When I go to "Form Designer" on an existing form, I get the standard Sitecore "The requested document was not found" page.
Requested URL: /applications/modules/web
User Name: sitecore\admin
Site Name: shell
If the page you are trying to display exists, please check that an
appropriate prefix has been added to the IgnoreUrlPrefixes setting in
the web.config.
Note that the requested URL is stated as /applications/modules/web instead of /applications/modules/web forms for marketers.
A lot of development has occurred on this site recently, so I'm not sure when exactly this started happening.
Additional: info:
Folder and file permissions are correct.
I've tried reinstalling the WFFM package, and made sure that all the files are in place.
Several processors have been added to the HttpBeginRequest pipeline, but I removed them all to test if they were the cause - they weren't.
I haven't upgraded Sitecore since WFFM was working and the version is correct.
No errors are logged
EDIT
This also seems to be affecting the Sitecore Security Editor:
Requested URL: /appl
User Name: sitecore\admin
Site Name: shell
If the page you are trying to display exists, please check that an
appropriate prefix has been added to the IgnoreUrlPrefixes setting in
the web.config.
EDIT 2
Further investigation with this is making me think it is related to the Requested URL. I originally thought the the "Not found" page was displaying the requested url incorrectly. However, if I attempt to goto mysite.com/sitecore/shell/applications/fake folder with spaces/fake page with spaces I get this error message:
Requested URL: /applications/fake folder with spaces/fake page with
spaces
User Name: sitecore\admin
Site Name: shell
If the page you are trying to display exists, please check that an
appropriate prefix has been added to the IgnoreUrlPrefixes setting in
the web.config.
As you can see the Requested Url is correct in the error message. So in relation to my problem, I think maybe Sitecore is requesting the wrong URL in the first place.
Additionally if I go to the go the following url by typing directly into the browser, then the Security Editor opens as expected:
mysite.com/sitecore/shell/Applications/Security/User-Editor
This is quite old now but I thought I'd provide an update for anyone else who encounters the problem.
Unfortunately, Sitecore support weren't able to help beyond pointing out that setting the addAspxExtension attribute to 'true' in the link provider seemed to solve the problem. This may have been acceptable except that extensionless URLs were important to the customer.
In the end I had to amend my link provider so that addAspxExtension is set to 'true' in the web config, and then I set it to false inside the GetItemUrl method for specified sites only.
So now whenever the context site is 'Shell' or 'Admin' etc, the extensions are added by default, but switched off in my main website.
Of course, this is a work around. I still don't know how to actually fix the problem
So the first thing that I am going to tell you is that I suspect that there is something wrong with your site declaration for Sitecore Modules. In your web.config, there's a site declaration for "modules_shell" and "modules_website". Those are where the code files that run the modules are usually located... a shell folder to run the parts that run in the Sitecore shell and a web folder to run the part that is accessed by the externally facing site. Please check your site declarations (and the form.config file) to make sure that you're not in live mode or something like that. I would definitely say that this is where you should start looking.
The next thing is to say that your comments about Sitecore not serving a url in the /sitecore/shell directory is really not surprising. Sitecore processes all requests unless you specifically tell it to ignore requests (like setting it in the IgnoreUrlPrefixes in web.config), it's going to try processing it. Like going to /sitecore/shell/applications gives me a layout error because it doesn't have anything set to handle that request. Now your error suggests that there is something wrong with Site declarations.. however, even if they were all right, it still wouldn't work.

Multilingual sites in Sitecore

I'am new to Sitecore and had few questions on Multilingual sites in Sitecore
First I added the new language to the existing site and try to access the same with sc* parameter for testing purpose.
The site throws "Input string is in incorrect format" error. Though the content is not added for this it should be a blank page, not sure why it's throwing the error.
If, by chance, your Sitecore instance has multiple sites (i.e. you're using the SiteDefinition.config file to define separate site host headers) then you need to specify the language per-site, in the language attribute within the particular site node in SiteDefinition.config.
The value would be the language code, like "en-US" or "da-DK" for instance. For reference, see this (this references the web.config, but it applies to SiteDefinition.config as well).
besides the sc_lang query parameter, you can also give the language in the url.
for example /en leads to English homepage, /nl-NL to the dutch homepage. the first part of the url is the language.
so /en/page1.asp leads to the en version of the page1 item under your home.
The current language is stored in a cookie check the website#lang cookie.. Where website is the name of the website.
The default language is located in the web.config or include files
With the LinkManager in the web.config you can configer the appearance