Welcome to WebmasterWorld Guest from 54.224.113.125

Forum Moderators: ocean10000

Message Too Old, No Replies

What is the MS equivalent of .htaccess

... for doing 301s etc

     
7:05 am on Jul 2, 2004 (gmt 0)

Junior Member

joined:June 13, 2003
posts:151
votes: 0


I guess there's no equivalent of real .htaccess in MS but...

I've just taken on management of a "windows server 2003" "Microsoft-IIS/6.0" site and I want to create fresh pages (with meaningful names), put them in sub-directories and tell robots and browsers where the new html can be found.

What's the best way to do this (with or without using http-equivalents?)

Cheers, Sam.

7:06 am on July 2, 2004 (gmt 0)

Senior Member from GB 

WebmasterWorld Senior Member brotherhood_of_lan is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 30, 2002
posts:4843
votes: 2


I think this is the popular one

[isapirewrite.com...]

Not free unfortunately

10:44 pm on July 6, 2004 (gmt 0)

Junior Member

joined:June 13, 2003
posts:151
votes: 0


Thanks brotherhood - I just have the one site on a virtual host so I don't think I have the ability to install something at this level.

I've decided to simply wait for the SE to pick up the new pages then delete the old pages. I've put up a custom 404 page that refreshes after 7 seconds to the site map.

Less than ideal, but it's a new site (3 months old) in for the long haul so I'll just have to wear the delay.

It's weird working in an environment where you have such little control....

6:20 am on July 7, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 12, 2003
posts:772
votes: 0



As long as you can have a custom 404 page you can do this.

The basic plan for the 404 is this:

read requested url from query variable passed by iis for the 404

if one of your old pages, 301 redirect to new page
else
return a 404

the above presumes that you erase all your old pages so that iis will invoke your custom 404 because it cannot find the page requested.

6:47 am on July 7, 2004 (gmt 0)

Junior Member

joined:June 13, 2003
posts:151
votes: 0


Thanks plum, you are giving me some hope....

The hosting company advised me to create a 404b.htm in a directory called /errormsg. (Is this sounding familiar?)

I cannot see a query variable in the url, the dead page is visible as the url when the 404b.htm page is displayed. Can you please tell me what to test for and how (ie. is there some way to query the url string using html?)

Also, how does one actually return a 301?

I'm pretty sure ASP is available on the site (included in the price) so perhaps I should be using an ASP approach? Or perhaps a "frontpage extension"? It's all Greek to me!

Many thanks, Sam.

6:51 pm on July 7, 2004 (gmt 0)

Preferred Member

10+ Year Member

joined:Feb 27, 2003
posts:637
votes: 0


bpresent,
Well the first thing that you would do is to create an asp page named whatever you want. Now either through your control panel or the hosting company, they will have to change the default 404 to the page you created.

Now in the new 404 page, let's say you have it named 404.asp.

Within this page you would have something like this.


<%
OPTION EXPLICIT
Dim oldurl

oldurl = Request.ServerVariables("QUERY_STRING")

If oldurl = "http://www.oldsite.com/old-page.html" Then
Response.Status = "301 Moved Permanently"
Response.addheader "Location", "http://www.newsite.com/new-page.html"
Response.End
End If
%>

Oh, check this thread also. [webmasterworld.com...]
Now this isn't tested, but it should work.

7:02 pm on July 7, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Oct 3, 2003
posts:792
votes: 0


Regarding the original question, what is the .htaccess equivelant for doing 301 redirects? You manage this from the IIS console. You can select a file or folder, and then specify the new location and whether or not this is a permanent or temporary redirect.

Not that this helps you in a shared hosting environment :)