I've just recently started trying to use Umbraco, so I hope this doesn't sound stupid.
I'm trying to set the default web page to my site, but I am having no luck. I recently installed umbraco v 4.7.1.1, along with the blog starter kit that you can select when using the installation wizard.
In my "Content View", I have the following structure:
Content (folder)
Personal Site (folder)
Index
About
MyTestBlog
When I look at the Properties tab for MyTestBlog, the Template property is set to "Blog Post". When I go to www.mytestsite.com, the content on MyTestBlog shows up on the site's default web page.
I have the Template property for the Index page set to "Textpage". I right clicked on the Personal Site folder and selected Sort. From the Sort pop-up window, I dragged Index to the top of the list so that it has the sort order of zero (0).
From what I have read, whatever is set as the first item will be the default web page in Umbraco, but this does not seem to be the case for me. No matter what I try, I cannot get Index to be the default web page for the site.
I have checked to ensure that all of the web pages have been published. Is there something that I am missing or not doing?
Thanks!
Not a stupid question at all, it's a common stumbling block when first learning Umbraco. I know it tricked me when I started. Your assumptions are correct in that Umbraco will display the first node as the default page, but it's the node Personal Site which is actually the first node.
To fix this, add a property with the alias umbracoInternalRedirectId of data type Content Picker to your Personal Site document type. Then in the content section pick the node you want the Personal Site node to default to (it doesn't even have to be the first subnode).
Normally, you could use a property alias of umbracoRedirect but Umbraco doesn't allow this on the first node without it's problems. umbracoRedirect is safe to use (and generally preferred) for any other node in the site.
Or, if the website has already been published, add a rewrite rule to the Web.Config:
<rewrite>
<rules>
<rule name="Redirect to front" patternSyntax="ECMAScript" stopProcessing="true">
<match url="^$" />
<action type="Redirect" url="/yourViewName" />
</rule>
</rules>
</rewrite>
Just include that inbetween the system.webServer tags within the configuration tags, and replace yourViewName by the appropriate view's name (like Contact or Work) and you're done!
Best of luck.
Related
I have created a page in Umbraco 7.
I need to pass an id to this page and I want to read that parameter inside the template.
If I use this url: http://www.example.com/product?id=10 I have access to the id inside template using Request["id"] which is fine. but the issue is I want to have my Url like http://www.example.com/product/10 but if I use it I receive: "404 - File or directory not found.".
I actually thought it might be resolved by Umbraco default routing but it is not.
I also tried IIS URL rewrite, but I believe it should be a better way in Umbraco to handle it same as ASP.NET MVC Routing.
You could use this rewrite rule to handle the routing before the request reaches Umbraco.
<rule name="Product Rewrite" stopProcessing="false">
<match url="product/([0-9]+)/"/>
<action type="Rewrite" url="/product/?id={R:2}"/>
</rule>
Another approach is to implement a custom ContentFinder which enable you "find" the content on your own. This allows you make even prettier urls for your products if you can determine the ids from the name in some way. This link https://24days.in/umbraco-cms/2014/urlprovider-and-contentfinder/ provide some information on how to implement a ContentFinder.
When I browse to my startpage, e.g. /sv I get a blank page that just says "Default Page". However when I try /sv/ it works. Subpages like /sv/example work without slash though. I'm using Sitecore 7.1 with only MVC views.
Remove the default.aspx file from the web root.
That will fix your problem.
When requesting URLs without a slash at the end, the "StripLanguage" processor of the preprocessRequest pipeline rewrites path to the value of the Settings.DefaultPageName setting ("default.aspx" by default). Since such page physically exists on your site, ASP.NET MVC routing system does not handle such request, and the file itself is served. This behavior is controlled over the RouteCollection.RouteExistingFiles property (false by default), please refer to the following article for the details:
http://msdn.microsoft.com/en-us/library/system.web.routing.routecollection.routeexistingfiles.aspx.
In other case, when a slash is added after a language, this won't happen, since the "StripLanguage" processor does not rewrite the path (which is also not an expected behavior). As a result, request URL does not match the "default.aspx" static file in the site and request is getting processed by ASP.NET MVC.
I suggest you to add the following setting to the "Web.config" file (instead of creating a "default.aspx" page), which points to the "default" page without extension:
<settings>
<setting name="DefaultAspxPageName" value="default"/>
</settings>
After that, the /default URL, without ".aspx" extension, will be processed by MVC and the appropriate item will be rendered independently of a slash after the language URL section.
On my side it works.
I want to point out that the answer to this is not my own but given from the support over at Sitecore who I want to extend a big "Thank you!" to. I had googled this forever until they helped me and I thought that I want to have this document and easily found when others struggle with it. A bug is filed and they are working on fixing it.
DefaultAspxPageName is Hidden Setting.. We can find more such hidden settings..#
http://www.newguid.net/sitecore/2014/sitecore-hidden-string-configuration-settings/
I'm publishing an MVC 3 site to a go daddy account. I'm using the FTP Publish utility in VS 2010. The site publishes "okay". But here is the issue:
On my local machine, when I run it the web address is:
localhost/Student/Create
On my go daddy account, I have created a subdirectory called mvctest.
I have created a subdomain called mvctest.mysite.com that points to the virtual directory at mvctest. This works fine.
But after I publish my site to www.mysite.com/mvctest, I am getting an additional /mvctest/ directory in all of my links. What I want is:
mvctest.mysite.com/Student/Create
what I get is:
mvctest.mysite.com/mvctest/Student/Create
What's interesting is that if I manually type in what I want, the page loads fine. If I've hard-coded a link to the root, it's fine, but all of my Url.Content and Html. Links add the additional mvctest directory..
I've searched all over and haven't found an answer to this dilemma. I tried in the web.config, but I don't think that does it. I feel like something in the FTP Publish utility in VS2010 is altering the routing structure in my global.asax file, but I'm not sure.
Any suggestions appreciated.
Is your virtual directory an application? If it's not set as an application, IIS will treat the root of your site as the application and add the subdirectory. See this post.
The following solved the same issue for me and is quoted from a blog post I found (source):
So now for the solution, and I probably should have mentioned this at the beginning but hopefully you’re using IIS7 with the URL rewriting module installed (it is installed by default when you use IIS7 on GoDaddy).
Simply add the following into your web.config’s system.webServer element:
<rewrite>
<rules>
<rule name="Remove Virtual Directory">
<match url=".*" />
<action type="Rewrite" url="{R:0}" />
</rule>
</rules>
</rewrite>
All this does is “rewrite” the URL with itself. This causes URL Rewrite to add the original URL (the one with no folder name) to a ServerVariable which is used by ASP.NET MVC to generate other URLs.
I have a project where I want to use Umbraco only for the backend as a CMS. But I want to disable it completely in the frontend handling my aspx pages for me, and I want to use the API to get the content I want. In other words, I want to create an aspx page manually which will not be handled by the Umbraco engine. Right now, if e.g. you create a test.aspx page and put it in the root folder, it will return 404 because Umbraco will look for a node with this alias.
Ho do I disable the .aspx handling by Umbraco, but still be able to use Nodefactory etc. in codebehind to access the content?
Thanks
Themos
There are a few ways you can override pages so that their URLs are not "caught" by Umbraco, you can do this by modifying the following appSettings items in the web.config file.
To add single files:
<add key="umbracoReservedUrls" value="~/myfile.aspx,~/config/splashes/booting.aspx,~/install/default.aspx,~/config/splashes/noNodes.aspx" />
To add whole subdirectories:
<add key="umbracoReservedPaths" value="~/myfolder,~/umbraco,~/install/" />
You should be able to add ~/ to umbracoReservedPaths which would disable all URL mappings, I just tried it and it seemed to work. But I can't vouch that it'll have no unintended side-effects on the running of the Umbraco CMS.
I have a virtual directory created and a sub domain that points to that virtual directory. My links always route to subdomain.domain.com/subdomain/controller/action when they can leave off the subdomain link. Is there an easy way to stop that?
Also, it's the same problem when I mapped anotherdomain.com to my virtual directory. It ends up linking to anotherdomain.com/virtualdir/controller/action.
It just looks unprofessional to me to have all my links be myapp.com/myapp/action/controller.
I have also wondered this, but I don't believe that you can achieve this in the ready-made routing that comes with ASP.NET MVC.
Thankfully, the user has a great deal of freedom in choosing how they want to handle these things, and a solution that you may want to consider can be found here.
The ASP.NET MVC team appear to have recognised that this should be pre-baked into MVC by default, but I don't see anything being done about until v2 as it will require changes to the routing engine.
Failing this, you may want to consider url rewrites (this is obviously much easier if you have IIS7). Here is an IIS forum post discussing this.
IIS 7 Rewrite Example (taken from here):
<rule name="RewriteSubdomain">
<match url="^(.+)">
<conditions>
<add input="{HTTP_HOST}" type="Pattern" pattern="^([^.]+)\.myapp\.com$">
</conditions>
<action type="Rewrite" url="{C:1}/{R:1}" />
</rule>