IIS Redirect with Arguments - iis

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.

Related

Issue with redirection in IIS 10

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.

IIS Redirect from HTTP to HTTPS including Application Name

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}

redirect URL IIS on Windows 2008

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).

domain name with or without 'www'

I have a domain e.g. named www.example.com, when people type in example.com, it still can be accessed, but won't automatically add that 'www' to the url.
But as for website like facebook, if you type in facebook.com, it'll automatically add that 'www', BEFORE loading the page for you.
Probably I didn't explain it well, but guess you see the difference and get my point anyway.
So how can I make my domain acts like facebook, when people type example.com, it'll automatically add that www for them?
EDIT:
Ok, so I need a redirect to the 'www' subdomain. Actually I'm using nodejs, which hosted on Amazon EC2, to serve the webpage instead of Apache HTTP. So any equivalent of .htaccess in nodejs area?
I guess now the question shifts to more nodejs oriented, and it turns out it becomes a redundant of this thread:
Redirect all requests using Express 3?
Thanks all for your help.
you have to set your domain 301 permanent redirect in your control panel.
if your website is hosted in CPANEL then
GOTO -> Redirects in ( Domains Menu )
Choose the type Permanent (301)
choose your domain.com
www.domain.com in redirects to→ __
check the box on Redirect with or without www
finally CLick ADD
if your website is hosted in PLESK then
do it in your program level
or
plesk11.0.29 version above supports the 301 peramanent
You can do all of this with a .htaccess file.
https://kb.mediatemple.net/questions/242/How+do+I+redirect+my+site+using+a+.htaccess+file%3F
# This allows you to redirect your entire website to any other domain
Redirect 301 / http://mt-example.com/
Add this in a file named .htaccess on your host, but set it to the URL you want your main page to be.
To make a .htaccess file, you can always go in FTP, upload an empty .txt file, open it with notepad, put in the lines of code above, then rename it to .htaccess.

.htaccess + subdomain + redirect

Just wanted to know how we can redirect the subdomain to domain.
I have two domain which in pointing to my rails application and a subdomain
www.xyz.com
www.xyz.info
example.xyz.com
Now when the user access www.xyz.info the example.xyz.com page should open up but the address bar should be www.xyz.info.
So is it possible to redirect?
Thanks
Abhi
One approach should be to use a reverse proxy, using mod_proxy. In the configuration of www.xyz.info put
ProxyPass / http://example.xyz.com/
However, I think it would be much easier to just deploy the rails application twice, i.e. put the configuration that you have in example.xyz.com also into www.xyz.com.

Resources