Jamie McAllister
asked on
Redirect with a 301 Status
I've implemented a redirect to a new domain on a legacy BlogEngine install (running on ASP.NET).
The redirect itself works fine. You'll see I'm effectively removing the 'post' folder from the destination url etc.
Issue is that this is returning a HTTP Status of 200. I need to return a 301 for best SEO. I'd thought specifying redirectType of Permanent would have handled that. Any ideas?
The redirect itself works fine. You'll see I'm effectively removing the 'post' folder from the destination url etc.
Issue is that this is returning a HTTP Status of 200. I need to return a 301 for best SEO. I'd thought specifying redirectType of Permanent would have handled that. Any ideas?
<rewrite>
<rules>
<rule name="redirect" enabled="true">
<match url="^post/(.*)" />
<conditions>
<add input="{HTTP_HOST}" negate="true" pattern="^www.OldDomain.com/sharepoint/post/$" />
</conditions>
<action type="Redirect" url="https://NewDomain.com/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
<rule name="redirectFolder" enabled="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" negate="true" pattern="^www.OldDomain.com/sharepoint/$" />
</conditions>
<action type="Redirect" url="https://NewDomain.com/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
You're right, with Fiddler I'm seeing a 301, with Postman I wasn't.
However Google Webmaster Tools insists that "We couldn't find any 301-redirect directives for your site".
Am I missing something? I used a .htaccess file to redirect the root (non-ASP.NET) part of my website. But it won't work for the ASP.NET bit.
Is there some other file in my solution I should be tweaking?
However Google Webmaster Tools insists that "We couldn't find any 301-redirect directives for your site".
Am I missing something? I used a .htaccess file to redirect the root (non-ASP.NET) part of my website. But it won't work for the ASP.NET bit.
Is there some other file in my solution I should be tweaking?
are you looking at your home page? Apparently you need to point at the place you're redirecting to.
Also please see the following if you're looking for analytics using rewrites:
https://docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/using-outbound-rules-to-add-web-analytics-tracking-code
Also please see the following if you're looking for analytics using rewrites:
https://docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/using-outbound-rules-to-add-web-analytics-tracking-code
ASKER
Turned out my web.config changes were fine, and the error stemmed from something else entirely.
ASKER
Thanks for getting me to check the status using Fiddler, put me onto the right track.
{
// Code that runs on application startup
if (HttpContext.Current.Reque
{
HttpContext.Current.Respon
HttpContext.Current.Respon
}
}
Source:
https://stackoverflow.com/questions/2111955/global-301-redirection-from-domain-to-www-domain