Remove /sitecore from the URLs - url

I need to remove "/sitecore" from URLs because when I navigate to appropriate sites (www.site_name/sitecore) I will get empty page with no layout. I would like to ask you
1) Is good option to use redirect to solve my problem ?
2) Can this redirection of the "/sitecore" caused problems ? I found that in sites definition of my web config I have a lot of site definition like this:
site name="shell" virtualFolder="/sitecore/shell" physicalFolder="/sitecore/shell ... where "/sitecore" is part of some other paths so I am not sure.
I appreciate your help. Thx

Related

Get url of Orchard default pages

I am using orchard 1.9 and I am building a service in which I need to get current URL.
I have OrchardServices and from that I can get the URL like so:
_orchardServices.WorkContext.HttpContext.Request.Url.AbsolutePath;
This works like a charm for pages/routes that I have created but when I go to the Login or register page (/Users/Account/LogOn) the absolute URL is / and I can't find anyway to get the URL or at least any indication that I am in the LogOn or Register.
Anyone knows how I could get the full url?
If I understand what your're asking, you could use the ItemAdminLink from the ContentItemExtension class.
You will need to add references to Orchard.ContentManagement, Orchard.Mvc.Html and Orchard.Utility.Extensions, but then you will have access to the #Html and #Url helpers.
From there you will have the ability to get the link to the item using:
#Html.ItemDisplayLink((ContentItem)Model.ContentItem)
The link to the item with the Url as the title using: #Url.ItemDisplayUrl((ContentItem)Model.ContentItem)
And you should get the same for the admin area by using these:
#Html.ItemAdminLink((ContentItem)Model.ContentItem)
#Url.ItemAdminUrl((ContentItem)Model.ContentItem)
They will give you relative paths, e.g. '/blog/blog-post-1', but it sounds like you've already got a partial solution for that sorted, so it would be a matter of combining the two.
Although I'm sure there are (much) better ways of doing it, you could get the absolute URL using:
String.Format("{0}{1}", WorkContext.CurrentSite.BaseUrl, yourRelativeURL);
...but if anyone has a more elegent way of doing it then post a comment below.
Hope that helps someone.

Weird Route Value in Route

In my asp.net mvc 3 site my actual route looks like /FF.mvc/116/MVt?m=01-12-2012 but some of my users are getting error and they have weird route like
/FF.mvc/116/ossw=((qncufuh)niah(`r)mt
any idea where from this
ossw=((qncufuh)niah(`r)mt
coming from?
My hunch is that your applications pages are indexed by the search (google) engine (perhaps against your wishes :)). If you search anything for example your apps name in google you will see a similar ossw=((qncufuh)niah(r)mt` string in the address bar when the results are returned.
Some employee has searched the page link in google and tried to access it from there.
Inorder to prevent the search spiders from indexing your application's pages add a robots.txt file in your application.
Have you tried something like:
Url = "/FF.mvc/116/MVt?m=" + HttpUtility.UrlEncode("01-12-2012")
I don't know if the char '-' will be error.
the ((qncufuh).... might come from some strange language code.

Redirect URL without showing new URL?

Is it possible to redirect URL in to another URL without showing the new URL?
eg:
When users go to www.sample1.com/page1.html , it should show www.sample2.com/page2.html . But URL needs to be showing like it belongs to www.sample1.com , or something like this www.subdomain.sample1.com/blah.html.
I need to host some pages for another domain , but those pages should look like they belong to that domain or to a subdomain of that domain.
Using an iframe is not an option in my circumstances,any other suggestions are welcome.
The easiest is probably to use mod_proxy to display all the sample2.com pages in a sub-context:
ProxyPass /sample2 http://www.sample2.com
Thus, sample2.com/page2.html would display as sample1.com/sample2/page2.html.
Otherwise mod_rewrite may be of use as well, specifically the proxy|P flag.
Hope that helps.

how to remove sitecore folder name in the url?

I created a sitecore year/month/day folder structure in the content tree, when i view each article under the folder node, the url could be http://local/landing/year/month/day/article1.aspx, how could I make the url like this: http://local/landing/article1.aspx?
just remove the year/month/day structure in the url.
Is there some function in sitecore like remove or hide special templates in the frontend url ?
Any help , Thanks .
You can do it in 2 ways:
Use IIS 7 Url rewrite module to change the url. This way the url will be rewritten before it gets to sitecore and you don't need to change any code. You can find more info at the iis website
You can create a custom Item resolver and add it to the RequestBegin sitecore pipeline. Alex Shyba wrote about it here.
It sounds like you may have thousands of these items, but even so, you may want to use the built in functionality of Sitecore and consider creating aliases for each of these items. Programmatically creating an the alias on an ItemSaved event or ItemCreated is probably easiest.
As #marto and #seth have said, you can use URL rewriting or aliases to solve this.
There is, however, a drawback to doing this, irrespective of how you choose to do it.
If you have very many items (your structure makes it sound like you may do) then either method will require that the URL is unique. Removing the date structure from the URL means that all items in your landing section will require unique URLs (whether inherited from their item names or by some other means). This can impact on SEO for your site, as authors may have difficulty finding an unused name that is also human readable and good for SEO. It's unlikely you want to use ugly GUIDs in your URLs.
2 options
Change Bucket configuration and the set the required folder structure, bucket configuration can be found in Sitecore.Buckets.config file
Extend GetFromRouteValue Item Resolver and overwrite the ResolveItem() method to get the bucket item.
The default GetFromRouteValue class reference can be found in Sitecore.MVC.config file and replace this with your own customized implementation.
We have implemented with customized routing and getting the exact item if the route path matches.
Thanks,
Jisha

Rails route rewriting

I think this is an easy question. I am using this useful Flash Document Reader called FlexPaper. I have it embedded in one of my Show pages. But when I click the a link on their tool bar to show the document in a new browser, it points to the following link:
http://example.com/intels/FlexPaperViewer.swf?ZoomTime=0.5&FitPageOnLoad=false&PrintEnabled=false&SwfFile=%2FPaper.swf
which doesn't work, I get the following error:
ActiveRecord::RecordNotFound in IntelsController#show
Couldn't find Intel with ID=FlexPaperViewer
but if I remove the "intels" from the path so the url looks like:
http://example.com/FlexPaperViewer.swf?ZoomTime=0.5&FitPageOnLoad=false&PrintEnabled=false&SwfFile=%2FPaper.swf
It works fine.
My question is what is the best way to handle this? Can you write a route that rewrites a url that starts with intels/FlexPaperViewer.swf and remove the intels prefix? What would that look like?
Is there a better option?
Juat a thought, how about placing the FlexPaperViewer.swf inside public/intels folder?
So the directory structure will be
<project-directory>/public/intels/FlexPaperViewer.swf
Doing this will make the link correct. It seems to be easier to do it this way.
Hopefully it helps.
EDIT
Another alternative will be to see how the link was generated, maybe there is a parameter that you can set when you embed the FlexPaper.
I am not aware of any route modification that can do what you want. Maybe someone else can help on this.

Resources