IIS keep some urls when changing domain - iis

I will be changing a www server to be ww2. Making a new server the www server. The new server has IIS 8.5 running, with https, ASP.Net/MVC. The old server does not have https.
I have some urls that users may have bookmarked to the old www. I would like those urls to still work (doesn't matter if the browser displays ww2). I have made sure those urls are unique and don't conflict with any resource/path on the new server. Some urls are a resource like .html others are any in a path. Do I put all of those urls in as redirects in IIS on my new server? Are redirects the best of accomplishing this?

I think what you're looking for is the URL_REWRITE Extension.
You can download it here: https://www.iis.net/downloads/microsoft/url-rewrite
Then apply the rewrite rules at the server level not the application level. This will allow you to easily control the the flow of any your old URLs to your new location.
Depending on how many you have theirs a few different ways you can do it with URL_Rewrite.
To get you started here's a bunch of tutorials on how to use it: https://www.iis.net/learn/extensions/url-rewrite-module
After you play with it and if have any specific questions, just ask on stackoverflow and tag the question with URL-REWRITE-MODULE

Related

How do I redirect OldSite.com to NewSite.com/Sub/NewPage

I need to redirect several URLs to a new site that will have pages that replace the old sites. I don't care if the URL is masked or not. I just need the URL's to go to the new pages on the new combined site.
For example:
Oldsite.com redirects to NewSite.com/Sub/NewPage
Oldsite2.com redirects to NewSite.com/Sub/NewPage2
Oldsite3.com redirects to NewSite.com/Sub/NewPage3
and so on.
I've tried domain forwarding on the DNS level, but that isn't working (likely because of the subdirectories).
Problem is the New site was developed in Webflow and I don't have access to implement custom code for redirects.
My thought is to host a separate site to act as a hub that handles all the custom redirects to the New webflow site.
Any help or insight would be greatly appreciated.
Your scenario here isn't entirely clear on the types of redirections you're attempting to do.
If you're trying to redirect all paths from the old site to a specific destination page, like this...
oldsite.com/* ➜ newsite.com/sub/newpage
...many modern DNS providers support that.
If yours does not, you can switch your nameservers to Cloudflare DNS free edition, and you'll have the ability to define up to 3 page rules that support wildcard redirections like this.

DNS redirect of a url to another url

We are currently looking at identifying the best approach to carry out a redirection of a url folder to another url folder o a separate domain. We have tried a few options but have been unable to make this work. Any other redirection options such as apache, html etc are not possible. This url is only accessed through the browser by an application to download some files. This application cannot be changed but needs to download these files from another location.
Hence, we need to redirect the following:
https://sub1.domain1.com/xyz
to
https://sub2.domain2.com/abc/xyz
Any ideas how we can achieve this?
Note: we have full control of DNS of the domain1 and there are no plans to use this domain.
You can't do that with DNS alone. The DNS never sees the "path" part of the URL. You need a webserver aware of the situation who can provide a 302 redirect.

How to STOP redirecting my website to mobile.mywebsite.com in smartphones

I have developed a website www.mywebsite.com and it is ready to go live.
I have used Codeigniter framework.
When I enter www.mywebsite.com from any android/iphone, it redirects automatically to mobile.mywebsite.com and displays page not found error. I dont have any mobile site developed for this. I want to show the main site even on the smartphones.
I am not good at .htaccess file, and I am using default .htaccess to remove the index.php in the url.
I tried creating a subdomain mobile.mywebsite.com and pointed to root path. But same response. I search online, but didnt find anything on how to STOP redirecting.
Thanks in advance.
When I was uploading my local files into the server I was NOT overwriting the old ones assuming the folder is clean and no need to overwrite. But my hosting provider has default .htaccess which is redirecting to the mobile site.
I deleted the old one and gave my .htaccess without the mobile redirection and everything is in place now

forcing ssl for all embedded links using htaccess to tackle insecure content

I am trying to enforce SSL on a folder (blog admin). That part is fine - all pages are SSL, but the site is generating error messages for insecure contents on the page. I can go after all those links individually, to enforce SSL on the links.
I was wondering if that could be done through htaccess alone?
This is what I have done for SSL enforcing on the admin folder:
#forcing https for admin folder
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} admin
RewriteRule ^(.*)$ https://mysite.com/blog/admin/$1 [R,L]
How can I convert all the non ssl links to ssl on the same page ?
Addition:
1) I am using wordpress 3.6 with different plugins that come along with it. Only the admin areas is SSL, and the rest of it, other than login page (that is outside of admin is also SSL) are non SSL (for example the Blog feed for the end users).
2) A few of insecure contents are coming from my own site, but then there are others which are coming from the plugins I am using. For example disqus commenting system, and flickr.
3) I can force the internal links for images, css, and jscript by simply using 'setting for permalink' on wordpress (noticed the url was provided as http and not https). Similarly, I can locate and fix the other links like this one:
The page at https://mysite.com/blog/wp-login.php ran insecure content
from
http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js?ver=3.6
4) The issue is:
If I use permalink setting, then the blog links are created as https
instead of http, and that breaks the plugins I am using for the non
SSL pages, for example disqus comment feed don't show up on the blog
page. Secondly, The painful process of fixing all the non ssl links.
Also, I can always miss out on some of them, since I am doing it
manually. It would be really helpful, if I could enforce SSL for all
these non SSL links using htaccess, perhaps the only easy solution.
Rewrite rules (which are in in fact redirections, when it's about HTTP to HTTPS) won't help, since by the time the initial plain HTTP request reaches the server, it's too late.
It's the links on the page you serve that must be addressed. This is generally up to the application (e.g. your PHP/CGI applcation) running on the server, not up to the server itself. The server would need to be able to process the content of the responses it sends to replace these links, not just redirect the requests (like mod_rewrite does).
mod_proxy_html (distributed with Apache 2.4 or separately in earlier versions) is a module that can to in-depth processing of the response, but I'm not sure whether it can be used as a post-processing tool for PHP running on the same server, to rewrite the links it sends.
Of course, this won't fix links to external resources that are not available via https:// anyway.

IIS Permanent Redirects

I have seen a few things written about this and remember one where there was an XML file. So, there is an old URL and a new URL. If the user hits the old URL he is redirected to the new one.
The redirects can be from files that don't exist on the server eg new-jobs.php from Apache server has been moved to an IIS Server and the file is now called new-jobs.aspx.
Does anyone know of such a system or have a better solution?
Check out URLRewrite.

Resources