301 redirect on a non-aspx page?
hello, I'm in the process of upgrading a site's pages from htm static content to a dynamix aspx page. the problem is that I want to redirect users visiting the old pages to the new pages and I want to use the proper 301 "moved permanently" redirect to be search engine-friendly. Unfortunately I can't figure out any way to do this! the extension is htm, so I can't embed any server-side scripting to redirect the user and change the response code...
I know I can do a meta or javascript refresh but that's not the proper way to do it. I tried doing a redirect in IIS but I could only redirect a folder, not an individual file (this is IIS 7 by the way).
I thought maybe I could force asp.net to handle the htm extension and inject the redirect code that way but I couldn't figure out how to do it properly. Is there any other way to do a 301 redirect without using server side scripting or htaccess? I seem to be stuck and will probably just have to do the meta refresh
any help is appreciated, thank you!
SelArom
Junior Poster in Training
54 posts since Oct 2004
Reputation Points: 20
Solved Threads: 1
You should set this up in IIS using an http redirect.
You just need to have the file highlighted then in features view select http redirect then specify the new address in the box and check the two options for exact location and not the subdir and select the return code. and that should work
edit:
this is what it creates in your web.config
.webServer>
thank you for your reply! would it be possible just to put this in the web.config file for each page and be done with it? or do I have to do something in IIS to make it work?
EDIT: okay I tried it in the web.config and it didn't work. I tried to follow your IIS instructions, but after highlighting the file and switching to Features View, there is no entry for httpredirect. is there something else I need to enable? thanks!
SelArom
Junior Poster in Training
54 posts since Oct 2004
Reputation Points: 20
Solved Threads: 1
thanks again for the reply, I tried as you suggested, right-clicking and selecting features view, it does work as you described, showing the file instead of the website, but there is still no option to add a redirect. I would imagine that this is the reason it isn't working even when I add the code manually to web.config. Is there an option I need to be checking that enables redirects site-wide?
many thanks
SelArom
Junior Poster in Training
54 posts since Oct 2004
Reputation Points: 20
Solved Threads: 1
SelArom
Junior Poster in Training
54 posts since Oct 2004
Reputation Points: 20
Solved Threads: 1