Inhalte aufrufen

301 rewrite rules


  • Bitte melden Sie sich an, um eine Antwort zu verfassen.
1 Antwort zu diesem Thema

#1 Guest_nickh_*

Guest_nickh_*
  • Guests

Geschrieben: 09 December 2014 - 20:48

Hi guys,

 

I'm migrating product categories from an existing site and I want to make sure that I maintain the old site's SEO page rank for each category.  I would normally do this by using IIS 7 rewrite module, but it doesn't seem to be working as I think SmartStore's URL handling is preventing it.

 

I'm basically just wanting to:

 

When user tries to get to /someOldURL

I want to force a redirect (using 301 status code) to /newURL

 

Is this possible?  Why isn't IIS rewrite working?

 

Thanks,

Nick


  • MediArt gefällt das

#2 Guest_nickh_*

Guest_nickh_*
  • Guests

Geschrieben: 10 December 2014 - 12:47

I finally cracked this.  I had to use a redirect - not a rewrite, as it was causing a "Cannot use a leading .. to exit above the top directory" error (probably due to a static reference somewhere in the code).

 

If it helps anyone, here is my rewrite section in my web.config:

<rewrite>
<rewriteMaps>
<rewriteMap><add key="/oldUrl" value="newUrl" />
</rewriteMap>
</rewriteMaps>
<rules>
<rule name="Rewrite Rule 1 for StaticRewrites" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FINENAME}" matchType="IsFile" negate="true" />
<add input="{StaticRewrites:{REQUEST_URI}}" pattern="(.+)" />
</conditions>
<action type="Redirect" url="/{C:1}" appendQueryString="False"/>
</rule>
</rules>
</rewrite>