Remove /Pages from SharePoint URL

Topics: User Forum
Mar 3, 2010 at 4:26 PM

I'm trying to get this filter working with a SharePoint 2007 public site so that it removes the /Pages/ from the URL, e.g. a request to => (these are obviously examples). However I can't get my head around the regular expressions required and can't get it to work.

It's similar to this article ( which the guy resolved using the rewriting "engine" in IIS7 but unfortunately the site is sitting on Windows Server 2003 (IIS6) and re-using the same regular expressions doesn't seem to work.

Mar 4, 2010 at 4:43 AM

What did you try? This should work for the one example you gave:

# http://server/current =>  http://server/current/Pages
# (the default document will be automatically served, I suppose)
RewriteRule ^/([^/]*)$   /$1/Pages   [L]

# http://server/current/Document =>  http://server/current/Pages/Document
RewriteRule ^/([^/]+)/([^/]*)$   /$1/Pages/$2   [L]

Mar 4, 2010 at 2:27 PM

Thanks for that. Tried it but unfortunately getting another problem with an HTTP handler. Is there any way to only apply this to .aspx pages?

Mar 4, 2010 at 3:14 PM

yes, of course: modify the regex to match only urls that end in .aspx .    Append \.aspx before the $ in the test pattern for each rule.

I recommend reading the regex overview I wrote.   Read that, then use the testdriver.exe tool I provide with IIRF to test out scenarios.

I gave you the answer to your immediate question, but I don't really understand your requirements, I don't have the perspective you do, and so my answer isn't quite right, isn't sufficient.  Again.  Just like my last answer.  And so you're going to have another small question, and you'll post here, and it will take another day for me to reply, and so on.  Round and round we go.

You want a quick solution.  The best way to get that is to gain sufficient understanding yourself.  You said you can't get your head around the regex required.  You need that.  You can ask me questions, but I'll get back to you AT BEST every few hours, and after a few cycles, you'll realize this approach will take forever.  On the other hand if you spend some time reading the IIRF documentation and understanding regex, and testing it yourself, you'll be much more satisfied with your progress.  Regex can seem obscure, like black magic, and it is, at first, but with just a small investment in time, 15-20 minutes of reading, you will be much more capable. The overview I wrote has a TON of examples.   

I get the "what are the magic words?" question often.  People come in and ask "what's the magic ini file I can use to make my situation work the way I want it to?"  I can't answer that.  I can only offer specific help on specific questions.  You're going to be much more productive if you have the basic understanding yourself.  It's just going to take learning a few new things.  I tried to write it all up clearly in the fine documentation.

Good luck!