• Resolved davidmorgan2

    (@davidmorgan2)


    I want all my url ends with the slash (/)

    I try with the regular expresion:

    this: ^https://miweb.es(.*)
    to: https://miweb.es$1/

    any idea? Thanks.

    • This topic was modified 5 years, 10 months ago by davidmorgan2.
Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author John Godley

    (@johnny5)

    WordPress should do this for you already.

    Thread Starter davidmorgan2

    (@davidmorgan2)

    It does (the url it create are with slash) but i i write the url without slash it load without it i want to force to load always with it.

    Plugin Author John Godley

    (@johnny5)

    Sure, but that’s what I mean – WordPress will redirect to the version with a slash. You don’t need to do anything for this.

    Thread Starter davidmorgan2

    (@davidmorgan2)

    It doesnt.. if i write the url without the slash it load without the slash, thats why i need to do this redirection

    Plugin Author John Godley

    (@johnny5)

    Thread Starter davidmorgan2

    (@davidmorgan2)

    I already have those two options (From permalinks and yoast permalinks) configured in that way, but it isnt working, thats why i was thinking about doing it with a regular expression in redirections

    Plugin Author John Godley

    (@johnny5)

    I think it would be better to figure out why your WordPress settings aren’t working correctly. This is the default for WordPress, and works on every site I’ve tested.

    I guess you could use Redirection to do it. Your regular expression is not correct though and you would need to match anything that doesn’t end in a slash – currently it’s matching everything (slash or no slash). You also shouldn’t include the domain in your source.

    You can use https://regex101.com to test a regular expression.

    Thread Starter davidmorgan2

    (@davidmorgan2)

    I dont figure out how i can put the expression thats why i ask here, if you can help. Thanks.

    Thread Starter davidmorgan2

    (@davidmorgan2)

    I tried with this one which is supposed to work but neither..

    //matches the character / at the end of a line
    from: /(.*[^\/]$)
    //add the captured text with final /
    to: /$1/

    Plugin Author John Godley

    (@johnny5)

    That doesn’t work when I try it on https://regex101.com/

    /([^\/]+)$ seems better

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Redirect website without slash to with (/)’ is closed to new replies.