301 redirect to an existing page

Eduardo López asked on January 22, 2019 18:04

Hi everyone!

Someone of you knows how to force to remove the .aspx extension? My problem is that right now my site could enter as sitename/pagename and sitename/pagename.aspx, but that duplicates the results on google analytics and I want to force to remove the extension or make a 301 redirect to the same page without .apsx

Thanks,

Correct Answer

Trevor Fayas answered on January 22, 2019 18:34

First step is i would set Kentico's Url Extensions to be empty (Settings - URLs and SEO - Friendly URL extensions should be empty)

Then also on the same settings page, set "Redirect page aliases to main URL:" to true

Lastly, make sure that your web.config has the runAllManagedModulesForAllRequests="true" on the modules element so the above will work.

That should do the trick, you may still get 301 redirect notices on your SEO scans if you have hard-set links that you'll need to adjust, Kentico generated links should no longer have aspx though.

1 votesVote for this answer Unmark Correct answer

Recent Answers


Eduardo López answered on January 22, 2019 21:51

Thanks Trevor!

I did exactly what you said before, but when I visit the website it still open with the extention.

Is that ok and in the analytics it doesn't show anymore?

1 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on January 22, 2019 22:05

I'm sorry, i posted the wrong setting for the 2nd step:

Redirect pages to main extension: true

NOT

Redirect page aliases to main URL:" to true

1 votesVote for this answer Mark as a Correct answer

Eduardo López answered on January 25, 2019 17:34

Thanks Travor!! That works perfect!

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.