Showing posts with label URL. Show all posts
Showing posts with label URL. Show all posts

Tuesday, 5 February 2013

ASP: URL Rewrite and IIS7

   


Following a kind suggestion by a follower, today we are going to see how to use IIS URL Rewrite 2.0 for IIS 7.

First of all, what's URL Rewrite?
"IIS URL Rewrite 2.0 enables Web administrators to create powerful rules to implement URLs that are easier for users to remember and easier for search engines to find. By using rule templates, rewrite maps, .NET providers, and other functionality integrated into IIS Manager, Web administrators can easily set up rules to define URL rewriting behavior based on HTTP headers, HTTP response or request headers, IIS server variables, and even complex programmatic rules. In addition, Web administrators can perform redirects, send custom responses, or stop HTTP requests based on the logic expressed in the rewrite rules."

Rest assured, we can use it for a classic ASP site as well.
What we need to do is:
1) install URL Rewrite after downloading it from the Ms IIS site;
2) enable ASP.NET role service on IIS 7;
3) write a rule

Tuesday, 27 November 2012

JavaScript: validate an URL

   


I've already posted an article on how to validate forms with Regular Expression. But, have you ever needed to valid an URL?
We can do it quite easily using Regular Expressions and JavaScript. Specifically we are going to use the .test method.

The code
The first thing we need to do is set two variables: one is the URL to be validated, the second is the Regular Expression.
<script type="text/javascript">
var url = "http://www.google.com/";
var urlCheck = /^http:\/\/(www\.)?[a-zA-Z0-9-]{3,}\.[a-zA-Z]{2,}(\/)?$/;

Thursday, 23 August 2012

jQuery: extract the page title and URL

   


Sometimes we need to obtain the page title and URL that the user is viewing. This might be useful for different reasons: for example just to create breadcrumbs with customised menus, or simply because we need to gather where the user is.
We are going to use jQuery in order to do that.
Please follow me in this short example.

Friday, 11 May 2012

Blogger: prevent new country-specific URLs

   


As you may have noticed, the people of Blogger have decided to implement a new URL system. Basically, the blog URL is changing to a country specific domain based on the origin of the browser request.
To simplify it, if you visit the web thought from the UK, the original blog URL (which is thewebthought.blogspot.com) will be changed to thewebthought.blogspot.co.uk.
And that is happening for each country.
As a result, the new country specific URLs have, among others, a great impact on blogs traffic statistics. However there's a solution which is quite simple and which I explain in the following post.