I know what you would feel after reading this post. It seems so easy. And actually it should be the first thing which comes to developer's mind. But nowadays we're so spoiled with different CMS that we forget about basic things.
So, the task is to make URLs prettier for files located in 14\Layouts folder.
Let's say we have a page which references /_layouts/your.project.name/scripts/thursday.js. Sometimes it might not look very good. Moreover if it's public site than you might not want to scream: "This is Sharepoint!!!!!".
Let's say you want URL to be something like /style/scripts/friday.js. How would you do that? You think about some kind of URL rewriting, aren't you? Maybe about writing some custom http module/handler? Anything else?
The solution is so obvious and easy, so shame to you pal.
What you need to do is:

So, the task is to make URLs prettier for files located in 14\Layouts folder.
Let's say we have a page which references /_layouts/your.project.name/scripts/thursday.js. Sometimes it might not look very good. Moreover if it's public site than you might not want to scream: "This is Sharepoint!!!!!".
Let's say you want URL to be something like /style/scripts/friday.js. How would you do that? You think about some kind of URL rewriting, aren't you? Maybe about writing some custom http module/handler? Anything else?
The solution is so obvious and easy, so shame to you pal.
What you need to do is:
- Open IIS Manager
- Right click on your site
- Add Virtual Directory
- Set alias, e.g. style
- Set path to your folder in 14\Layouts hive

Then just type:
http://coolsite/style/scripts/yourcoolscript.js and go take a couple of beers. That's just it.
And don't forget: let's not make things complicated. We have our lovely women for that ;)
No comments:
Post a Comment