Mobile app version of vmapp.org
Login or Join
Cooney921

: IIS7 webpage redirect question Noob question here. I searched, but couldn't quite find anything that would explain how to do this. I'm using IIS7 on a 2 server web farm with traffic being load

@Cooney921

Posted in: #Iis7 #Redirects #UrlRewriting

Noob question here. I searched, but couldn't quite find anything that would explain how to do this. I'm using IIS7 on a 2 server web farm with traffic being load balanced to either of the two servers.

I have a URL something./org that goes to page something.mydomain.com
On this page there is a hyperlink that users can click on that will take them to something.mydomain.com/search.
I would like to redirect users that go to somethingsearch.org/ to redirect them to something.mydomain.com/search
Is this possible? I'm thinking an ISAPI Rewrite Rule might be necessary to accomplish this, but I'm unsure.

Sorry if there's not enough information provided. I was just thrown this little task earlier today and they're looking for a quick turnaround. If there are any questions or any other information that you might need, let me know and I'll see if I can dig it up.

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Cooney921

3 Comments

Sorted by latest first Latest Oldest Best

 

@Rambettina238

My co-worker that took this over was able to come up with a solution that worked for us on this one. Just figured I'd post to close the loop on this one so if anyone else runs into a similar issue, it might help them out as well.

He wrote an ISAPI ReWrite/ReDirect rule using the ISAPI ReWrite Manager for ISS that looks like this:

RewriteEngine on

RewriteCond %{HTTP_HOST} ^(www.)?domain.org$

RewriteRule ^(.*)$ something.domain.com/Search [I,O,RP,L]


This is very much in line with what you folks were saying, but the issue he ran into was with trying to maintain the same URL something.org while redirecting to a subdirectory within the site.

So, he just said to hell with it and redirected to a different URL with the sub-directory included.

Thanks all for your input!!

10% popularity Vote Up Vote Down


 

@Radia820

I have a rewrite rule that forces my site url to be prefixed with "http://www". This is mainly for google analytics. So if someone goes to mywebsite.com it will redirect them to www.mywebsite.com.

You can accomplish this in two ways:


Create the rewrite in IIS if you have IIS URL Rewrite installed. Here is how it is done:


Add a rewrite rule in IIS Manager


Match URL Section


Name the rule
Select "Matches the Pattern" under Requested URL:
Select "Regular Expressions" under Using:
Add this expression "^(.*)$"
Check "Ignore case"






Conditions Section


Set "Logical grouping" to "Match All"
Click the "Add" button
Enter "{HTTP_HOST}" for the Condition input
Select whether or not you want it to match the pattern (in my case I did not)
Enter the expression "^www.(.+)$"
Check "Ignore case"






Action Section


Select "Redirect" for the Action type
Enter your redirect URL - in my case it was: "http://www.{HTTP_HOST}/{R:1}"
Check "Append query string"
Select "Permanent (301)" as the redirect type




Save the rule



If the site is a .NET site, edit the web.config to add the rule under the "system.webServer" section

<rewrite>
<rules>
<rule name="wwwrewrite" enabled="true" stopProcessing="true">
<match url="^(.*)$" ignoreCase="true" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTP_HOST}" pattern="^www.(.+)$" negate="true" />
</conditions>
<action type="Redirect" url="http://www.{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
</rules>
</rewrite>



Hope this helps....

10% popularity Vote Up Vote Down


 

@Courtney195

You can use the IIS URL Rewrite extension from Microsoft.


IIS URL Rewrite 2.0 enables Web administrators to create powerful rules to implement URLs that are easier for users to remember and easier for search engines to find. By using rule templates, rewrite maps, .NET providers, and other functionality integrated into IIS Manager, Web administrators can easily set up rules to define URL rewriting behavior based on HTTP headers, HTTP response or request headers, IIS server variables, and even complex programmatic rules. In addition, Web administrators can perform redirects, send custom responses, or stop HTTP requests based on the logic expressed in the rewrite rules.


IIS URL Rewrite is the equivalent of apache mod_rewrite for IIS.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme