I just updated my website, and now my old and new urls doesn't match. The problem is that i uses Æ in my urls. The old site converted Æ to OE but the new site is converting Æ to O.
Therefore i have a lot of urls on google that does not work. I tried to make a redirect in my web.config but cant get it to work.
<rewrite>
<rules>
<rule name="oe to e" patternSyntax="Wildcard" stopProcessing="true">
<match url="(.*)oe(.*)" />
<action type="Redirect" url="{R:1}o{R:2}" />
</rule>
</rules>
</rewrite>
Hope someone can help
Related
I need to redirect a bunch of news articles to a different url format using web.config.
For example, this Url:
https://www.example.com/footer/press-resources/press-releases/press-release-detail/abcd-press-release-item
Should be redirected to this Url:
https://www.example.com/about/press-releases/press-release-detail/abcd-press-release-item
In this example, as you can see this portion of the Url is staying intact /press-release-detail/abcd-press-release-item but everything else before this should be redirected. The only dynamic part of the Url is the article's title which is at the end of the Url, in this case: abcd-press-release-item
I have about 300 items, obviously redirecting them one by one is going to take some time. Is there a way to rule them all out and mass redirect the old Urls to the new ones?
This is a Windows/IIS server with a .NET CMS and a web.config file.
I tried this rule and it didn't work for me:
<rule name="301 Redirect 1" stopProcessing="true">
<match url="^https://www.example.com/footer/press-resources/press-releases/press-release-detail\$" />
<action type="Redirect" url="https://www.example.com/about/press-releases/press-release-detail" redirectType="Permanent" />
</rule>
Try to use this URL Rewrite rule:
<rewrite>
<rules>
<rule name="Test" stopProcessing="true">
<match url="(footer)/(press-resources)(.*)" />
<action type="Redirect" url="https://www.example.com/about{R:3}" />
</rule>
</rules>
</rewrite>
<rule name="Directories The" stopProcessing="true">
<match url="^Directories/The" />
<action type="Redirect" url="/" />
</rule>`
I have two url like this www.mydomain/Directories/the and www.mydomain/Directories/the-hindu. But i only want to redirect first url only. If i put above code two urls are redirecting.
I tried with exact match and wild card also not working. I dont want www.mydomain/Directories/the-hindu to my home page
`
The problem is that your regexp ^Directories/The is matching for both URLs:
www.mydomain/Directories/the
www.mydomain/Directories/the-hindu
You need to add the end of string condition to your regexp. The correct rule should be:
<rule name="Directories The" stopProcessing="true">
<match url="^Directories/The$" />
<action type="Redirect" url="/" />
</rule>`
And this rule will match only www.mydomain/Directories/the
Hi there,
Just a simple question. I Have a Domain with path, let's say exampleme.com, and this page has a specific page: exampleme.com/game.php. Is there a way to completely rewrite the link to another domain on that page? So that exampleme.com/game.phpbecomes game.com?
I've tried this, but since I'm fairly new to the web.config rewrite module, I'm a bit clueless.
` <rule name="Examplerule">
<match url="http://game.com" ignoreCase="false" />
<action type="Rewrite" url="/game.php" appendQueryString="false" />
</rule>`
Rewrite works only on your current domain. You need an redirect.
<rules>
<rule name="Game" stopProcessing="true">
<match url="/game.php" />
<action type="Redirect" url="http://game.com" />
</rule>
</rules>
I was looking into this Seemingly simple redirect in IIS using web.config file because I have a similar situation, but the approach mentioned there doesn't seem to be working for me.
I have a help section on a web site, which for now I want it to redirect to another place. The rest of the site should stay the same, which means that only the help section/content should make the user go to another site:
device.domain.com/help
device.domain.com/help/version
Should make the request go to
company.custhelp.com
But for example device.domain.com/api should still work. This is what I tried. If I test the pattern inside of IIS it says that it will work. What am I missing?
<system.webServer>
<rewrite>
<rules>
<rule name="Help Redirect" stopProcessing="true">
<match url="(.*)/help(.*)" ignoreCase="true" />
<action type="Redirect" url="http://company.custhelp.com/" appendQueryString="false" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
...
</system.webServer>
The match url will try to match on the path after the domain, starting from after the slash. So it should be like so:
<match url="help(.*)" ignoreCase="true" />
The match url that you wrote would match on device.domain.com/temp/help, but not device.domain.com/help.
If pointed to http://domain.com it redirects to http://www.domain.com/thesite/index.asp which is the actual location. No matter the page, it always appends the actual folder path.
ive been using this script for canonical redirection, included in every page.
If InStr(Request.ServerVariables("SERVER_NAME"),"www") = 0 Then
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www." &_
Request.ServerVariables("HTTP_HOST")&_
Request.ServerVariables("SCRIPT_NAME")
End if
I have several sites in a shared hosting, each in its own folder.
How can i prevent this?
Thanx for your help
Ok after further diggin' i finally bumped into a solution. Turns out IIS7 had url redirection rules enabled, so this can be accomplished through web.config, like this
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect to WWW" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^yoursite.com$" />
</conditions>
<action type="Redirect" url="http://www.yoursite.com/{R:0}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
I overlooked it before cause it was listed as ASP.NET solution, not classic ASP.
But there it is, solved.