2020年12月31日星期四

Htaccess Redirect URL with two forward slashes (not double) won't work

I want to redirect from one domain to a new domain. At the same time, the URL structure has changed.

This is wordpress, and I placed this code above the Wordpress stuff, as well as tested it here: https://htaccess.madewithlove.be/

  1. I tried this, which doesn't work:

    Redirect 301 /parentpage/title https://www.newdomain.com/newtitle  
  2. Also, when testing it at https://htaccess.madewithlove.be/, I do have this redirect:

    Redirect 301 /parentpage https://www.newdomain.com/parentpage  

    The tester would skip my preferred redirect above, and use this one, leaving me with this, which does not exist:

    https://www.newdomain.com/parentpage/oldtitle  

    Even when I place the preferred redirect above this one. I need both, unfortunately.

  3. Have also tried the following RewriteRules (not all at the same time)

    ReWriteRule https://www.olddomain.com/parentpage/oldtitle/ https://www.newdomain.com/newtitle  ReWriteRule /parentpage/oldtitle/ https://www.newdomain.com/newtitle  ReWriteRule "https://www.olddomain.com/parentpage/oldtitle/" "https://www.newdomain.com/newtitle"  

I think it has something to do with that second forward slash separating the parentpage name and page title, but I can't figure out how to fix it.

https://stackoverflow.com/questions/65526082/htaccess-redirect-url-with-two-forward-slashes-not-double-wont-work January 01, 2021 at 06:46AM

没有评论:

发表评论