WordPress.org

Ready to get started?Download WordPress

Forums

Redirection
Problem redirecting url with / and without / (3 posts)

  1. Amisanoai
    Member
    Posted 1 year ago #

    Hello,

    I don't know if it is a bug but when I put a 301 redirection like domain.com/news it doesn't redirect domain.com/news/ (with the "/" at the end)...

    For this case I need to put the both url with and without the "/"... that take me a lot of work.

    I think when it is a modified post it works but with a page it doesn't work...

    http://wordpress.org/extend/plugins/redirection/

  2. Amisanoai
    Member
    Posted 1 year ago #

    Also when the url ends with .htm redirection doesn't works...

  3. sroot
    Member
    Posted 1 year ago #

    "omain.com/news it doesn't redirect domain.com/news/"
    "Also when the url ends with .htm redirection doesn't works..."

    That means your source doesn't match the requested url. Create a redirection that matches that in addition to the one you have that's working (or modify your source to a regex that matches both).

    EG: Using a regular expression you can only .html posts that by:
    Source: /(\d*)/(\d*)/(.*?).html
    Target: /$1/$2/$3/
    Where the brakets mark out the parts the regular expression applies;
    / = /
    (/d*) = any number of digits, when the next character is not a digit it must be
    / = /
    ..again..
    (.*?) = Any number of characters or digits [the .* is any quantity of, ? is any character but won't match spaces if I remember correctly)
    finally ending in .html

    For me this matches
    /2012/11/my-post-title.html and turns it into /2012/11/myposttitle/

    I made some notes for myself on my blog

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.