URL Rewriting to Prevent Duplicate URLs

As a heads up for people - in the version of Ionic Rewrite that I downloaded (IonicIsapiRewriter-1.2.11b), RP is not the correct syntax for permanent redirects, it is R=301. Ionic accepted RP, but it was doing 302 (temporary) redirects. I’m no expert, but the articles I’m reading indicate that 301 redirects are the way to go. Also, I had no trouble getting Ionic to run. You do need to make sure that the IIS Guest user (ISR_machinename) has permission to access the folder you put the dll and ini file in, though.

I’ve installed isapi rewrite and iconic rewrite, iconic was actually easier to get working on one site but as soon as I started putting it on more sites on the same server it quickly killed the server.
I’ve recently had another problem caused by removing the index pages as well, unless your index pages are static html you won’t want to add the redirects that don’t show the page.

remove index pages from URLs

RewriteRule (.)/default.htm$ $1/ [I,RP]
#RewriteRule (.
)/default.aspx$ $1/ [I,RP]
RewriteRule (.)/index.htm$ $1/ [I,RP]
RewriteRule (.
)/index.html$ $1/ [I,RP]

I was doing some testing with an ajax page and the request kept loosing all it’s values, this was because isapi rewrite kept intercepting the request and redirecting without keeping the posted values, this also caused problems with another regular .net page all because they were named default.aspx

By commenting out the redirect for default.aspx I was able to get the pages working properly, this took the better part of a day for me to track down.

Hi There:
I am in the middle of a URL rewrite project where the requirement
is for me to have a .aspx filename in the URL for my url rewriter to get control. I have an actionless form as well.

Obviously this approach seems to not work for Directories http://www.foobar.com/categeries/Springs/ or even the main site http://www.foobar.com (when it does not have the default.aspx) when I am trying to do a postback from a control on that page. The initial rendering works ok.

(a) I think I can use Iconic to solve this problem, right?
(b) If yes, can I use the Iconic filter to push all incoming requests that are missing the default.aspx to include it so that the final url on the client browser would make have the default.aspx even if they typed in http://www.foobar.com for an web address.

Would I be able to do that with this filter?

Any pointers would be appreciated. thanks much!

KP

For those of us who use shared hosting and want url rewriting to work, I came up with a nice way to get extension-less urls working without the performance penalty for routing all content through asp.net and the solution is 100% C# code.

Take a look here for the details:
http://pragmaticprose.com/PermaLink,guid,e6d205ab-3edb-4b84-9e7c-6d6a28476e13.aspx
Any feedback on my solution is welcome.

Hi Jeff,

I have a question about using Ionic’s ISAPI Rewrite Filter. In the article, you say you could not get it to work on IIS ver 5.

I am doing development work on a windows xp with IIS 5.1. So, will the ISAPI rewrite filter not work on my development machine(cos its IIS 5.1) ?

Is it possible to install IIS 6 on windows xp? (The microsoft website says IIS6 only runs on Windows Server OS)

Thanks,

I tried the isapi rewrite and I couldn’t get to my website after that. I vopied the code just changed test to e-notations

Guys,

if you’re serious about using a paid but serious solution that is fully compatible with apache mod_rewrite (not just similar or wannabe mod_rewrite), then you should consider IIS Mod-Rewrite.

http://www.micronovae.com/ModRewrite/ModRewrite.html

Also, the Pro version supports .htaccess. That’s damn cool!

I would like to mention that that we (Helicon Tech) have released new version of ISAPI_Rewrite that is now nearly 100% Apache mod_rewrite compatible. Please see compatibility chart here: http://www.helicontech.com/isapi_rewrite/doc/compatibility.htm

As for best URL format practice my answer is: keep URLs as short and descriptive as possible. Generally it is better to use dash #8216;-#8216; or underline #8216;_#8217; separators for parameters instead of slash #8216;/#8217; but it mostly depends on your web site design. It is better to omit extension or use .htm/.html

Link example: http://www.somesite.com/articles/best_url_format_practice.htm

And freeawre ISAPI_Rewrite version (Lite) is still the best free URL rewriting solution available. To apply rules to specific web site you only need to precede rules with this line:

RewriteCond %{HTTP:Host} (?:www.)?myhostname.com [NC]

How can I avoid the following:

the original URL is http://www.pocketgadget.org/2008/01/14/serendipity-10-accidental-inventions/

but somebody has submitted it to Didd as
http://www.pocketgadget.org/2008/01/14/serendipity-10-accidental-inventions#html

so now Google has two copies of the same page. I have tried to do a 301 redirect from the second URL to the first and still nothing.

I am a bit lost with regards to this one. Anything i should be down at the server level that I am not aware of ?

Yes I agree with you.
The www in the domain name is very ugly.
You can also redirect via PHP-file to a domain without www.

The proper way of doing this is to always include a HTTP Content-Location header on non#8208;preferred URIs. This is a lot faster than rewriting and #8208;directing the user to other URIs.

For example, a user requests /document from example.tld; anaccompaniedt that document from that source acomanied by a HTTP header telling the user client#8212;including search engines#8212;that the #8220;Content-Location: http://www.example.com/document.[eng].[utf-8].xht#8221;. To save bandwidth, this can be a relative#8208; instead of an absolute URI when the request indicates that the preferred host or full URI already is known.

This is a power tip for advanced users. :wink:

Ionic’s ISAPI Rewrite is still actively maintained, still free, and still works! It runs on IIS5 IIS6 and IIS7. Latest new feature: Rewriting HTTP Headers the same way you can rewrite URLs.

How can I avoid the following recursive loop:

OLD URL is http://www.example.com/movies/home.aspx
for SEO we make URL as http://www.example.com/movies/

to achieve we write Rules in httpd.ini file as
RewriteRule /movies/home.aspx /redirector.aspx?URLAction=movies/ [I,L]
RewriteRule /movies /redirector.aspx?URLAction=movies/ [I,L]
RewriteRule /movies/ /movies/home.aspx[I,L]

problem is browser showing this message Firefox has detected that the server is redirecting the request for this address in a way that will never complete

how to resolve this recursive loop ?

See this with comple working sample code a href= http://dotnetkeeda.blogspot.com/2009/04/url-rewriting-mapping-in-aspnet.htmlhow to rewrite url/a

Cheers

See Sample code here

http://dotnetkeeda.blogspot.com/2009/04/url-rewriting-mapping-in-aspnet.html

IEEE article link is dead–and the IEEE site downloads a file ending in .pdf, but containing HTML.

Try this link instead: http://snipurl.com/ieee-dry

I’ve always like the format of

http://server.com/category/resource.format

.aspx or .jsp aren’t formats (they are technologies for generating HTML or XHTML). On a site I used to run called radiomixtape I had the following URL structure

http://radiomixtape.com/mixtape/1.html
http://radiomixtape.com/mixtape/1.xml
http://radiomixtape.com/mixtape/1.pls
http://radiomixtape.com/mixtape/1.jpg
http://radiomixtape.com/mixtape/1.swf

The .html was a full HTML webpage with the list of songs, an embed player to listen to them and links to share the mix tape as well as discover the artists on it), .xml was a clean XML representation of the tracks (and used by) .swf was a Flash Animation (which grabbed its track list by calling loadXML on its own URL but substituting .swf for .xml, really easy to make). .jpg was a generated cassette tap spine with the name of the mix tape written in a permanent marker font, and .pls was a WinAmp compatible play list of the songs in the mix tape. This was all accomplished with URLRewriting and a small set of servlets. Man I miss that code.

I am working on eCommerce website [Spider Office Chairs].

I want to rewrite my product page URLs.

After rewriting website will contain brand new product URLs.

Root category & Sub category URL will be as current one.

Right now, Google indexed 193 product pages so, can I set 301 or 302 redirection for it? OR Can I set custom 404 error page?

Will it affect on current search engine ranking of home page, root category page or sub category pages?

Thanks !!