Redirect or Rewrite Trying to Figure OutRSS

2 replies

Last post Sep 03, 2020 09:06 AM by Brucz

  • Redirect or Rewrite Trying to Figure Out

    Sep 02, 2020 02:18 AM|ccorkrum1|LINK

    Hi,

    I'd like to do a redirect or rewrite, not sure how.

    What I want is if someone clicks a link going to /policy/california-privacy-rights.html it allows it but if someone types in /policy/ that is redirects to /policy.html

    policy is a folder containing california-privacy-rights.html and policy.html is in the / folder

    I tried a 302 redirect but that redirects everything and I don't want that, I only want to redirect when they try and browse the root of the policy folder that doesn't include and index.html file.

    Thanks

  • Re: Redirect or Rewrite Trying to Figure Out

    Sep 02, 2020 08:31 AM|ccorkrum1|LINK

    Figured it out, for anyone else that might be looking for the same thing...

    Drop it in the privacy directory and when you browse /privacy it'll redirect to /privacy.html but allow anything else such as /privacy/california-privacy-rights.html

    Built in HTTP Redirection redirects everything, but URL Rewrite just redirects the single path as I was looking for.

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
    <system.webServer>
    <rewrite>
    <rules>
    <rule name="Redirect Rule 1" stopProcessing="true">
    <match url="(.*)" />
    <conditions>
    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" />
    </conditions>
    <action type="Redirect" url="/privacy.html{R:1}" redirectType="Found" />
    </rule>
    </rules>
    </rewrite>
    </system.webServer>
    </configuration>

  • Re: Redirect or Rewrite Trying to Figure Out

    Sep 03, 2020 09:06 AM|Brucz|LINK

    <div>Hi ccorkrum1,

    Is your issue solved?

    If your issue is solved then I request you to mark the helpful suggestion as an answer. This will help other people who face the same issue.

    If your issue still exists then try to refer the solution given by the community members.

    If then also you have any further questions then let us know about it.

    We will try to provide further suggestions to solve the issue.

    Thanks for your understanding.</div> <div>Best regards,</div> <div>Brucz</div>