4 Replies - 4015 Views - Last Post: 25 May 2011 - 05:38 AM Rate Topic: -----

#1 baxter111  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 77
  • Joined: 30-June 08

web.config 301 redirect

Posted 24 May 2011 - 06:27 AM

Hi Guys,

I am currently developing a new wordpress site for my company - we want to make sure all the 301 redirects work.

I am trying to create a 301 redirect within the web.config file but I can't seem to get it working properly.

Here is what I have at the moment:

<configuration>
	<system.webServer>
		<rewrite>
			<rules>
				<rule name="wordpress" patternSyntax="Wildcard">
					<match url="*" />
						<conditions>
							<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
							<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
						</conditions>
					<action type="Rewrite" url="index.php" />
				</rule>
			</rules>
		</rewrite>
	</system.webServer>
</configuration>



If anyone can help me out it would be great.

Thanks,

Scott

Is This A Good Question/Topic? 0
  • +

Replies To: web.config 301 redirect

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6066
  • View blog
  • Posts: 23,526
  • Joined: 23-August 08

Re: web.config 301 redirect

Posted 24 May 2011 - 07:17 AM

Think I'll move this to ASP.NET. The IIS guys there may be able to help you out.
Was This Post Helpful? 0
  • +
  • -

#3 SurfingShark  Icon User is offline

  • D.I.C Head

Reputation: 38
  • View blog
  • Posts: 188
  • Joined: 18-April 11

Re: web.config 301 redirect

Posted 24 May 2011 - 05:56 PM

Not sure exactly where you were going with that, but if you're looking to redirect from a 301 error, this is typically how it is done in the web.config, in the system.web element:

<customErrors mode="RemoteOnly" defaultRedirect="AllOtherErrors.aspx">
    <error statusCode="301" redirect="ErrorPageFor301s.aspx"/>
</customErrors>


Let me know if you have any questions about how to implement this.
Was This Post Helpful? 0
  • +
  • -

#4 baxter111  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 77
  • Joined: 30-June 08

Re: web.config 301 redirect

Posted 25 May 2011 - 02:35 AM

View PostSurfingShark, on 24 May 2011 - 06:56 PM, said:

Not sure exactly where you were going with that, but if you're looking to redirect from a 301 error, this is typically how it is done in the web.config, in the system.web element:

<customErrors mode="RemoteOnly" defaultRedirect="AllOtherErrors.aspx">
    <error statusCode="301" redirect="ErrorPageFor301s.aspx"/>
</customErrors>


Let me know if you have any questions about how to implement this.


Thanks for the input but I think we are getting a little confused.

Basically we have created a new website some of the links that are out on the internet have now changed and instead of them links going to a 404 page we would like them to redirect to the new correct page.

The new site is built with wordpress.

Any help would be great.

Thanks,

Scott
Was This Post Helpful? 0
  • +
  • -

#5 SurfingShark  Icon User is offline

  • D.I.C Head

Reputation: 38
  • View blog
  • Posts: 188
  • Joined: 18-April 11

Re: web.config 301 redirect

Posted 25 May 2011 - 05:38 AM

Then just set the statusCode to "404" and have the redirect go to your new site.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1