The first tip I have is that while developing the rewrites don't use permanent redirects (i.e. use temporary until everything is working correctly) as your browser will cache permanent redirects.
I'm not sure what you want to achieve with the 404. You could also try "/(*).(html|php)" for the rewrite rule - everything will then try to get to a page and if 1 does not exist the standard 404 will be used.
Now, old site have top positions by some keywords with old pages .html an some .php
i have try to do this, but in ASP 4.0 standard mode .html redirections are not working, so i have then setup INTEGRETED PIPELINE, but in this mode redirections are working, but it seams somthing is not workig well with clientdependency and can not open .cshtml file form developer editor
i did not know that there is problems with permanent redirects...
most important thing is that i want to keep google ranked and indexed pages
i have posted before question about asp mode, IN INTEGRETED MODE SOME BACKEND FUNCTIONS ARE NOT WORKING, IN STANDARD MODE CAN NOT BYPASS IIS 404 ERRORS AND DO .HTML AND .PHP REDIRECTIONS
UrlRewriting 301 asp 4.0 .html .php
Hello,
please help, i need to do url permanent 301 redirecting .php and .html url-s to asp new pages like /home/
www.mysite.com/about-us.html to www.mysite.com/about-us/
www.mysite.com/otherpages.html to www.mysite.com/error-404/
www.mysite.com/catalog.php to www.mysite.com/catalog/
i see that umbraco only works with aspx pages, please how to do this ?
my sites are on iis7 ASP 4.0 STANDARD ( NOT INTEGRETED PIPELINE, this mode not working at all)
Please suggest !
The first tip I have is that while developing the rewrites don't use permanent redirects (i.e. use temporary until everything is working correctly) as your browser will cache permanent redirects.
Something like this might do the trick:
<add name="Redir"
virtualUrl="(.*)://www.mysite.com/(about-us|catalog).(html|php)"
rewriteUrlParameter="IncludeQueryStringForRewrite"
destinationUrl="$1://www.mysite.com/$2/"
ignoreCase="true"
redirect="Domain"
redirectMode="Permanent" />
I'm not sure what you want to achieve with the 404. You could also try "/(*).(html|php)" for the rewrite rule - everything will then try to get to a page and if 1 does not exist the standard 404 will be used.
Now, old site have top positions by some keywords with old pages .html an some .php
i have try to do this, but in ASP 4.0 standard mode .html redirections are not working, so i have then setup INTEGRETED PIPELINE, but in this mode redirections are working, but it seams somthing is not workig well with clientdependency and can not open .cshtml file form developer editor
i was setup url rewriting like this
<add name="ToWww"
virtualUrl="^http\://mysite.com/(.*)"
destinationUrl="http://mysite.com/$1"
redirectMode="Permanent"
redirect="Domain"
ignoreCase="true"
rewriteUrlParameter="IncludeQueryStringForRewrite" />
first i have redirect IMPORTANT pages
<add name="goToServices"
virtualUrl="/services.html"
destinationUrl="/services/"
redirectMode="Permanent"
redirect="Domain"
ignoreCase="true"
rewriteUrlParameter="IncludeQueryStringForRewrite" />
<add name="goToCatalog"
virtualUrl="/catalog.php"
destinationUrl="/catalog/"
redirectMode="Permanent"
redirect="Domain"
ignoreCase="true"
rewriteUrlParameter="IncludeQueryStringForRewrite" />
then NOT IMPORTANT to 404
<add name="goHtmlNotUsefulTo404"
redirect="Domain"
ignoreCase="true" rewriteUrlParameter="IncludeQueryStringForRewrite"
virtualUrl="/(.*).html"
redirectMode="Permanent"
destinationUrl="/error-404/" />
<add name="goPhpNotUsefulTo404"
redirect="Domain"
ignoreCase="true" rewriteUrlParameter="ExcludeFromClientQueryString"
virtualUrl="/(.*).php"
redirectMode="Permanent"
destinationUrl="/error-404/" />
i did not know that there is problems with permanent redirects...
most important thing is that i want to keep google ranked and indexed pages
i have posted before question about asp mode, IN INTEGRETED MODE SOME BACKEND FUNCTIONS ARE NOT WORKING, IN STANDARD MODE CAN NOT BYPASS IIS 404 ERRORS AND DO .HTML AND .PHP REDIRECTIONS
What iis settings you using, version, mode in this case ?
And is it this in urlRewirite.config or in web.config ?
<add name="Redir"
virtualUrl="(.*)://www.mysite.com/(about-us|catalog).(html|php)"
rewriteUrlParameter="IncludeQueryStringForRewrite"
destinationUrl="$1://www.mysite.com/$2/"
ignoreCase="true"
redirect="Domain"
redirectMode="Permanent" />
Thank You
i have found solution, it is workint via <rewrite> and web.config ...
thank You for tip about temporary :-)
is working on a reply...