homepage Welcome to WebmasterWorld Guest from 54.242.231.109
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
Forum Library, Charter, Moderators: ocean10000

Microsoft IIS Web Server and ASP.NET Forum

    
What is the MS equivalent of .htaccess
... for doing 301s etc
bpresent




msg:953712
 7:05 am on Jul 2, 2004 (gmt 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.

 

brotherhood of LAN




msg:953713
 7:06 am on Jul 2, 2004 (gmt 0)

I think this is the popular one

[isapirewrite.com...]

Not free unfortunately

bpresent




msg:953714
 10:44 pm on Jul 6, 2004 (gmt 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....

plumsauce




msg:953715
 6:20 am on Jul 7, 2004 (gmt 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.

bpresent




msg:953716
 6:47 am on Jul 7, 2004 (gmt 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.

macrost




msg:953717
 6:51 pm on Jul 7, 2004 (gmt 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.

john_k




msg:953718
 7:02 pm on Jul 7, 2004 (gmt 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 :)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved