Forum Moderators: open

Message Too Old, No Replies

301 Redirect

For all domains

         

Alternative Future

12:09 pm on Oct 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi all,

I would like a 301 redirect rule that checks the requesting domain, similar to the following .htaccess I have running on an apache server.

RewriteCond %{HTTP_HOST}!^www\.domain\.net
RewriteRule (.*) [www....] domain.net/$1 [R=301,L]

The issue I have is that the server I am using on this domain is IIS alongside Tomcat as the application server. And I do not think I can use this .htaccess? Reading over IIS documentation it talks about the IIS admin panel and adding an entry for each domain I wish to redirect to the main one. Is there a better solution, that would just redirect any incoming domain to the main one without having to a) remember all the incoming domains b)cover any domains that someone else might direct to the site etc.

TIA,

-Gs

[edited by: Alternative_Future at 12:09 pm (utc) on Oct. 26, 2006]

Alternative Future

2:10 pm on Oct 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sorry I forgot to add to the last post that the server is inhouse and we do have isapi_rewrite installed.
I have tried the suggested changes to the httpd.ini file such as:
RewriteCond Host: ^domain\.com
RewriteRule (.*) http\://www\.domain\.com$1 [I,RP]

But it does not work. I can confirm that isapi is working as the URL rewriting works fine.

-gs

Alternative Future

10:12 am on Oct 27, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Solution use the httpd.ini ISAPI_Rewrite with the following:

RewriteCond Host: (?!(?:www\.)?domain\.com).*
RewriteRule (.*) http\://www.domain.com$1 [I,RP,U]

-Gs

MThiessen

5:38 pm on Nov 14, 2006 (gmt 0)

10+ Year Member



Just a quick question:

Why is it everyone is 301ing with modrewrite? Why not go into .htaccess and put:

301 redirect /old.html [new-site...]

?

Does this not return 301 in the header?