Hi I need to create for my www.company.com hosted in IIS with .NET apps...a specific RULE that when my URL contain www.company.com/.nsf/etc... redirect my request to a new external URL
external.company.com/.nsf/etc... (then reponde another web-server)
for example:
if the URL is www.mywebsite/page/page.aspx&id=4 responde IIS but when the URL is
www.mywebsite/page/page.nsf&id=4 IIS need to redirect the user to external.mywebsite/page/page.nsf&id=4
Is possible that?
Yes, this is possible.
The redirect rule needs to use 'Regular Expressions'.
The pattern you're looking for is:
^(.*)\.nsf(.*)$
and the Redirect URL would be:
http://external.mywebsite.com/{R:1}.nsf{R:2}
The action type would be 'Redirect' and redirect type can be Permanent (301).
Related
I have hosted a website in IIS but the site is always redirecting to Https localhosts eventhough i provided only http protocol port.
but when i browse the site it is redirecting to
https://localhost/
No idea why this site is behaving like this ?
There must be an HTTP redirect rule, click on your site, and then find the URL rewrite component, delete the rules you don’t need, so that no redirection will occur.
I'm adding a URL redirect rule to redirect a user from HTTP to HTTPS in a way that it preserves the original query. For example...
http://localhost/myapp/test >>
https://localhost/myapp/test
http://localhost/myapp/test?id=test >>
https://localhost/myapp/test?id=test
However the application name isn't being included in the redirect so what I actually get is the following...
http://localhost/myapp/test >>
https://localhost/test
Inbound Rule
IIS structure
Sites
Default Web site
MyApp
I believe I'm missing a IIS variable in my redirect url https://{HTTP_HOST}/{R:1} which represents the application.
Is there a IIS variable that represents the application level(MyApp) I can add to the redirect URL, or another way of doing this?
I managed to get this working by adding the URL variable.
https://{HTTP_HOST}{URL}
Trying to 301 redirect traffic from:
www.domain.com/directory/
to
new.domain.com/directory/
It also needs to redirect:
www.domain.com/directory/dynamicallygeneratednames.html
to
new.domain.com/directory/dynamicallygeneratednames.html
I can make the first work easy enough but the second bit I just can't find the correct settings in the url rewrite or the http redirection modules in IIS. The full urls aren't actually files they are dynamically generated.
Any ideas?
You can do this using IIS URL Redirect Module and here is how to use it
then you will have to use some regex to separate parts of the original url
so lets consider www.domain.com/directory/whatever/comes/here/of/any/lengths
you can use this ^(/directory)(/.*)? regex pattern in iis redirect module to separate /directory and /whatever/comes/here/of/any/lengths into two chunks
{R:1} & {R:2} or {C:1} & {C:2} [depends how you use it]
then your final redirect should look like where you chose the new domain, /directory is matched and rest of the url gets transferred over
new.domain.com/{R:1}{R:2} or newdomain.com{C:1}{C:2}
I am looking to mask or cloak a URL with a subdomain.
For example, if I have the URL http://example.com/news/article/this-is-an-article it would be possible to visit http://test.example.com/this-is-an-article and the same page would display. Notice: the desired secondary URL is a subdomain of the original URL.
I am using IIS 7. All of the examples I have looked at only change the structure for the existing URL (instead of mapping it to a sub-domain). I am looking for something different to a redirect (perhaps a rewrite, if that is the correct term).
Assuming you are using the IIS rewrite module, there are two main response types: Rewrite and Redirect.
A rewrite takes the existing url and changes it internally within the same site, so that a url that doesn't really exist on the site is remapped to an existing endpoint. The user does not notice the difference, the requested url returns the expected content. This only works within a site.
A redirect is used when you need to return content from a different site (such as in your case). Instead of rewriting the url internally, a 301 or 302 with a new url is returned to the browser. The browser than just requests that new url and gets the content from the second site. The user will notice a change of the url in the address bar.
So you have to use the redirect response type in the rewrite module, only in this case you can specify an absolute URL such as http://example.com/news/article/this-is-an-article
If both example.com and test.example.com are mapped to the same IIS site, you could use a rewrite rule.
I know you can do page redirects with IIS so if someone hits example.com it sends the user to www.example.com but is there a way to do something to make it possible to redirect with the values from example.com/index.aspx?p=1 to www.example.com/index.aspx?p=1
If you are using IIS 7 or above you can use URL Rewrite ( http://www.iis.net/download/URLRewrite ) for that very easily, it includes a template that will actually do the "canonical host name" for you.