Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Barry Corrigan 32 posts 145 karma points
    Jan 18, 2018 @ 14:49
    Barry Corrigan
    0

    301 redirects, so all pages have .aspx

    Hi there,

    I'm hoping someone can help me. I've seen a lot of posts about redirecting all pages to friendly URLs by removing the .aspx extension.

    I'm looking to do this the other way around. So all directory & page URLs redirect to .aspx.

    For example this page has two links being indexed on google

    • www.domain.com/about-us
    • www.domain.com/about-us.aspx

    I'm looking to redirect /about-us to /about-us.aspx

    so both pages are not being indexed on Google only the .aspx page is being indexed.

    Can someone help me get this sorted?

    Thanks Barry

  • Sam Marshallsay 35 posts 135 karma points
    Jan 19, 2018 @ 17:03
    Sam Marshallsay
    0

    Set up an IIS rewrite rule with a regex match to any url that doesn't have a file extension and redirect

  • Mark 91 posts -18 karma points
    Jan 19, 2018 @ 17:12
    Mark
    0

    Try adding this to your web.config:

    <rewrite>
      <rules>
        <rule name="Add ASPX" stopProcessing="true">
            <match url="(.*[^/])$" />
            <conditions>
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            </conditions>
            <action type="Redirect" redirectType="Permanent" url="{R:1}.aspx" />
        </rule>
     </rules>
    </rewrite>
    
  • Barry Corrigan 32 posts 145 karma points
    Jan 22, 2018 @ 09:22
    Barry Corrigan
    100

    Thanks for this Mark. Adding this returned an 500 error with a load of .aspx extensions applied to the URL. See here, any ideas?

    enter image description here

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Jan 22, 2018 @ 12:16
    Alex Skrypnyk
    0

    Try this one:

    <rewrite>
      <rules>
        <rule name="Add ASPX" stopProcessing="true">
            <match url="(.*[^/])$" />
            <conditions>
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
    <add input="{REQUEST_URI}" pattern="(.*[^/]).aspx$" negate="true" />
            </conditions>
            <action type="Redirect" redirectType="Permanent" url="{R:1}.aspx" />
        </rule>
     </rules>
    </rewrite>
    
  • Barry Corrigan 32 posts 145 karma points
    Jan 22, 2018 @ 16:44
    Barry Corrigan
    0

    Thanks for this Alex, this worked for me

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Jan 22, 2018 @ 21:04
    Alex Skrypnyk
    0

    You are welcome, Barry!!!

    Have a great evening

  • Barry Corrigan 32 posts 145 karma points
    Jan 26, 2018 @ 09:10
    Barry Corrigan
    0

    While the above solution worked. It made the Umbraco Control Panel break.

    No JS or CSS files could be loads (Too many redirects). See the attached image. enter image description here

    This is how the front end looks

    enter image description here enter image description here

    Any ideas on how to get around this?

Please Sign in or register to post replies

Write your reply to:

Draft