I am trying to do url rewriting in sharepoint . I have done something and its working fine but the problem is when I click on by default controls in sharepoint like edit page, approve or any links they are pointing to the old one and not to the new one and because of that I m getting 404 not found.
If anyone is having idea how to solve this in sharepoint .I have seen postback posts of Scott but in that he has mentioned postback with controls you create in asp.net add form browser but what abt existing ones in sharepoint. do I need to add something in the master page.
Any help would really be appreciated.
You could try overriding SharePoint's default postback handler (javascript function) using either an HttpModule, or by creating a control that replaces the old url for the new one, generating an postback function overide that uses that "translated" url. Then add the control to the masterpage.
Not too sure if this is possible. My guess is that you might run into some request validation issues when you do this.
EDIT:
Read scott guthrie article about this subject: article
How do you do your rewriting, e.g. what are your rules?
Mine does it in such a way the normal urls still work. Page editing is done through using the normal urls, so you don't get problems like this.
Related
I have set up a small XPage and have until now used the full path to the Xpage for testing, i.e.
http://devsrv1.magerman.ch/Development/Schulungen/Schulungen1_0/Schulungen_(1_0)_Dev.nsf/HomeWithDataView.xsp
I then tried to apply a Web Site Document
But the links are no longer currently functioning. I have the feeling that I'm missing something pretty basic, and am unsure as to what the best practice is. I'm quite happy with having the original request to the hostname resolve to a full path, i.e.
input
schulungen.magerman.com
and have it resolve to
schulungen.magerman.com//Development/Schulungen/Schulungen1_0/Schulungen_(1_0)_Dev.nsf
but haven't found a way to do this elegantly.
At the moment, my relative links '/OtherXpage.xsp' fail as they try to get to schulungen.magerman.com/OtherXpage.xsp
Any pointers?
Create a Web Site Rule. You can create it from your Web Site document in edit mode with action button " Web Site ... / Create Rule".
You can find a description how to fill the fields here.
The problem is usually that you need to add a trailing slash to the hostname
http://www.xpagedeveloper.com/2013/quicktip-get-right-path-when-autolaunching-an-xpage
I have Sharepoint 2010 instance on URL: http://dale/
The default location of Site Pages Library is http://dale/Pages/
I would like to change this to http://dale/Sider/
Is this possible? If yes, then how? Maybe some kind of redirection is possible?
Yes it is possible.
Start here: http://prodactor.blogspot.com/2007/11/sharepoint-moss-url-rewriting.html
It's not as easy as rewriting the url. SharePoint itself will still produce links to the /Pages library through its navigation controles etc. You'd have to fix that too.
Also, when you rewrite the url, you can get problems with editing pages because some of the Ajax calls use the browser url to construct references to the webservices needed.
I would try to get out of doing it ;)
I am using views module. I have created blocks using views and a url using page display. This is for taxonomy. So my views url looks like this "news/science" So if someone click on the link he should be taken to www.example.com/news/science. However i am taken to a unstyled page with broken links. But when i try to use the url www.example.com?q=news/science i am taken to a proper page with correct data.
The issue is only with taxonomy related terms.
i.e all urls www.example.com/news/technology , www.example.com/news/sports appear broken and unstyled however if i manually visit www.example.com?q=news/technology and www.example.com?q=news/sports i am taken to a proper page.
Can anyone suggest what could be the reason.
The same issues is with admin login and logout. If i use www.example.com?q=user and try to login i can login. Also if i use www.example.com?q=logout i can logout. But if i use clean url aliases ie. www.example.com/logout then i am taken to access denied page.
Do you have the Path module enabled? Thats the module responsible for mapping ?q=logout to /logout.
See here: http://drupal.org/handbook/modules/path
Have you changed anything in .htaccess? any mod-rewrite changes that might be skipping over those particular urls?
Is it possible, if so how(!), to auto redirect a user that doesnt have access to a certain page?
I can see that in many cases this could be a complete pain for a user and confusing, but in my situation it would be ideal.
Thx in advance!
Steve
Yes, this is possible.
You can do it by creating a custom HTTP Module, which can override the default access denied page.
Here's an example.
You can customise the accessdenied.aspx file in layouts folder.
Before customising it you need to take a copy.
with the writing of javascript (location.href=new file) code you can redirect user to other page.
I have a WSS 3.0 system using SSL where every page is supposed to be served as https. Almost all pages do come out as https, but in certain cases I click on a link and that brings up an http version of a page (which does not load). In those cases I have to put the 's' in by hand to get the page to load. Places where this happens are:
/_layouts/newgrp.aspx : when I try to create a new group, it takes me to http://server/_layouts/newgroup.aspx, although it should be https. The page does not load at http. It does load if I change the url by hand.
/_layouts/edtgrp.aspx : same thing as newgrp.aspx
if I go into a document library and view version history for a file, the URLs to the individual versions of that file are http. Interestingly, the browser status bar also indicates http when I hover over them (so it seems that SharePoint gets confused when it generates the links, rather than when I click on them)
To fix this, I have tried adding some javascript to the DOM that searches for instances of http and replaces them with https. This works in some cases, but there are some places where javascript can't reach, for example when SharePoint provides the target URL in response to a POST request, which I think is the case with newgrp/edtgrp.aspx.
I have also tried adding ISAPI filters to redirect pages from http to https. This seems to cause redirect loops, and in any case I'm not sure if such filters would preserve querystring or POST information.
Has anyone seen this problem?
Update: We have switched to ISA from Squid, and the problem continues in the version history, but not on new group or edit group. We have not seen any improvement yet from changing AAM settings.
Places where this is happening in ISA:
"Version History" under item in list or document library
"Manage Permissions" under item in list or document library
"Alert Me" under item in list or document library
"Add Users" menuitem in "People and Groups" page
"Group Settings" menuitem in "People and Groups" page
"Edit Group Quick Launch" menuitem in "People and Groups" page
"Set Up Groups" menuitem in "People and Groups" page
"List Settings" menuitem in "People and Groups" page
Not sure if this is it, but have you checked your alternate access mappings to make sure they say https instead of http?
I would echo the suggestion to check your Alternate Access Mappings. Is the SSL being done on the SharePoint Front Ends, or is it being done via a piece of dedicated SSL hardware?
Use an HTTP Module to modify SharePoint's output so that links are always changed to https. Such a module can plug into IIS and modify the HTML of anything rendered. I've used this technique to make SharePoint XHTML compliant and it works well.
Even better, almost all of the work has already been done for you. The UrlRewritingNet module is open source and available for free download. It should work fine for your SharePoint site. This tool has great documentation and uses regular expressions to match which URLs to alter. It should be pretty easy to write one for your case, e.g. ^http://. There's also many more advanced options you can take advantage of if necessary.
If you'd prefer to write your own then there is a good article called Rewrite.NET -- A URL Rewriting Engine for .NET on the 15 Seconds site.
Finally, if you're using IIS 7 you could try its URL Rewrite Module. I've never used this myself and don't know if it works with SharePoint, but it's the most UI-driven solution available.
Add a redirect in IIS from http to https. Every time you access that page it will redirect you to your https page instead.
I would also suggest placing WSS on another server to see if you have the same problems. If you don't, you might need to rebuild/migrate your stuff over.
Alex answered this question with an approach that I think will generally work. Here is how I fixed this specifically.
It looks like when a SharePoint aspx page is loaded, it populates a javascript structure of type ContextInfo (defined in init.js), which is instantiated in the variable ctx. That structure has a member called httpRoot, which is later used in core.js to build menuitems in various dropdown.
This ctx.httpRoot is for some reason populated in javascript in the aspx files created by SharePoint with a line like this:
ctx.HttpRoot = "http:\u002f\u002fsubdomain.domain.com";
Yes, it has Unicode slashes and it has http instead of https. I have no idea why. But, fixing this line of javascript seems to fix the problem.
I changed the line by adding a URL translation rule in ISA that converts http:\u002f\u002f\ to https:\u002f\u002f\ . I suspect that an HTTP module that makes the same replacement would also work. Or possibly some well placed javascript that reassigns the variable at some point.
I still believe this is not ideal and there must be a more appropriate way to fix these links.