OrchardCMS / OrchardCore

Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
https://orchardcore.net
BSD 3-Clause "New" or "Revised" License
7.44k stars 2.4k forks source link

SEO: Rewrite Module #9027

Open Flarescape opened 3 years ago

Flarescape commented 3 years ago

I know that there are some open issues out there, where other people asking for an extension to the autoroute module for path updates and redirects, but this does not cover actual SEO relevant redirects.

In O1 there was the so called Contrib.RewriteRules module, which worked with apache mod rewrite rules syntax. I've just created a custom rewrite module with the same functionality for OC, but with much less code. It's very helpfull that we now have "app.UseRewriter", which supports "RewriteOptions" and automatically parses apache mod rewrite rule syntax, so no need for a custom parser, but i don't think that we even need to use the apache rules, the build in syntax is much better.

So i think, that a rewrite rules module in the SEO section of the admin menu would be great. This could be easily achived by creating a content type with a list part of content type "rule". I think, a single roule needs a "From" and a "To" field and some options for the type of redirect, like permanent, etc. And of course support for wildecards.

Maybe this could be a standard part of the already existing SEO module, because i would consider this as a prerequisite for the Website/CMS part of OC.

jtkech commented 3 years ago

I've just created a custom rewrite module with the same functionality for OC, but with much less code.

Cool, are you open to create a PR based on your code? That would suggest a separate module / feature or as you think an additional feature of the SEO module

deanmarcussen commented 3 years ago

Yes, sounds great. We discussed it at a meeting either last week or the week before, if someone can find the video.

Probably a separate module. But open a pr please

Piedone commented 3 years ago

This would also be quite useful when migrating sites to Orchard and you want to keep old URLs working.

xperiandri commented 3 years ago

Any updates? We need redirects functionality. I thought about implementation of them as the ability to add a list of URLs to the main URL of AutoRoute. Where you add a rules for content type in AutoRoute module and they will redirect to that content item.

xperiandri commented 3 years ago

@sebastienros can we implement that? By adding a section on the SEO tab in a content item

deanmarcussen commented 3 years ago

Seperate Rewrite module. RewritePart for content items

plus would need to handle rules that are not content item related, or support for a decoupled razor page scenario.

Also discussed the need for a url tracker for tracking not found's. But that's a seperate feature.

Would also still be good to see what you have already done @Flarescape

For some ideas https://github.com/EtchUK/Etch.OrchardCore.SEO

Piedone commented 5 months ago

For now, you can use the URL Rewriting Middleware to add any redirects.

Autoroute redirects issue: https://github.com/OrchardCMS/OrchardCore/issues/8864.