nystudio107 / retour

DEPRECATED Retour allows you to intelligently redirect legacy URLs, so that you don't lose SEO value when rebuilding & restructuring a website.
Other
168 stars 24 forks source link

Add support for domaine redirect #123

Closed Megafry closed 3 months ago

Megafry commented 3 months ago

Is your feature request related to a problem? Please describe.

My customer has a lot of domains he bought for redirects.

I could not find a way to redirect just a domain, I also tried to use regex:

https://exemple-internet.ch(.*)
# no redirect https://exemple-internet.ch
# redirect https://exemple-internet.ch/old 

The goal:

exemple-internet.ch -> exemple.ch/abos/internet
exemple-internet.ch/old-> exemple.ch/abos/internet
exemple-energie.ch -> exemple.ch/energie

Describe the solution you would like

Approach 1: Make the regex https://exemple-internet.ch(.*) also match for https://exemple-internet.ch

Approach 2: Add a checkbox to allow match any.

Approach 3: Add an option "Custom" to the field Sites. If selected, a new field becomes visible to set the URL. (ex: exemple-internet.ch)

image

Describe alternatives you have considered

I try regex but without success.

khalwat commented 3 months ago

The issue here is you're using "Path Only" which ignores the domain part of the URL. Switch it to Full URL

https://nystudio107.com/docs/retour/configuring.html#manually-creating-static-redirects

Legacy URL Pattern - Enter the URL pattern that Retour should match. This matches against the path only (the part of the URL after the domain name), or the full URL, depending on the setting of Legacy URL Match Type. For example: Exact Match: /recipes/ or http://example.com/recipes/, or regular expression Match: .RecipeID=(.)

Megafry commented 3 months ago

@khalwat You are right it works with full URL, but unfortunately, I could not find a way to redirect a URL widout path.

The goal is to redirect https://exemple-internet.ch to https://exemple.ch/abo/internet

The redirect only works if the URL has a path

My config: image

khalwat commented 3 months ago

Maybe try:

https://exemple-internet.ch(.*)

?

Megafry commented 3 months ago

I tried all possible options the tool provides. Unfortunately, this also doesn't work.

https://exemple-internet.ch(.*)