Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 3 of 3

Thread: incoming URL rewrite not working

  1. #1
    BUBU is offline Member
    Join Date
    Mar 2006
    Location
    Mississauga, ON Canada
    Posts
    73

    Default incoming URL rewrite not working

    I am having problems trying to get incoming URL rewrite working. I would like to have < http://www.healthandsafetystore.com/..> chgd to <http://healthandsafetystore.com/..> .
    I have made the following chgs in web.config:
    in <configSections>
    Code:
     <section name="rewrite" requirePermission="false" type="Microsoft.Web.Management.Iis.Rewrite, Microsoft.Web.Management.Iis" />
    in <system.webServer>

    Code:
       <rewrite>
          <rules>
                <rule name="Redirect to nonWWW" stopProcessing="true">
                  <match url=".*" />
                  <conditions>
                    <add input="{HTTP_HOST}" pattern="^www.healthandsafetystore.com$" />
                  </conditions>
                  <action type="Redirect" url="http://healthandsafetystore.com/{R:0}" redirectType="Permanent" />
                </rule>
    
          </rules>
        </rewrite>
    What am I missing? I am using ML v9013. Reason for doing this is that the SSL certificate is for nonWWW. Sometimes a Google link was WWW and when customer presses Add to Cart after selecting from Google, it states that site is not secure due to no certificate.

    Any assistance would be appreciated.
    Last edited by BUBU; 08-19-2010 at 11:57 PM. Reason: spelling error

  2. #2
    webopius is offline Senior Member
    Join Date
    Nov 2008
    Location
    London, UK
    Posts
    440

    Default

    Hi

    Have a look at your App_Code/SkinBase.cs file.

    The logic for redirecting from a non-www to a www- based site is already there and it might be better to use this as a starting point for doing the reverse process.

    It's this section you need to work on...

    if (!AppLogic.IsAdminSite && AppLogic.OnLiveServer())
    {
    ...your code here...
    }

  3. #3
    BUBU is offline Member
    Join Date
    Mar 2006
    Location
    Mississauga, ON Canada
    Posts
    73

    Default

    Thanks Webopius,

    That did the trick. Works like a charm.

    Cheers