Reputation: 4781
I have a website that is running on Microsoft Azure. I am developing a new CMS system for this website and will be using https instead of http for the new website. So I have to redirect all the old urls to the new urls. The old and new urls are different - it is not just the http vs https that is different.
What is the correct way to do those 301 redirects for all my old pages? It must be done correctly so it wont affect SEO.
For Apache web server you can just create a .htaccess file with old and new url and that will be used as the 301 redirect file. See this: https://mediatemple.net/community/products/grid/204643080/how-do-i-redirect-my-site-using-a-htaccess-file There must be something similar for Azure and asp.net.
Upvotes: 0
Views: 1335
Reputation: 12174
If you are just rewriting the scheme from http to https, then you can use the following rule in <system.webServer>
:
<rewrite>
<rules>
<rule name="Force HTTPS" enabled="true">
<match url="(.*)" ignoreCase="true" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
Upvotes: 1