We just copied our site to a new url. To preserve the links we're trying to 301 redirect the old urls to the new website.
My htacces code looks like this
Redirect 301 / https://www.bpmverhuur.nl
Redirect 301 /verhuur-grondverzet-minigraver-15ton-verhuur/ https://bpmverhuur.nl/verhuur-grondverzet-minigraver-15ton-verhuur/
When navigating to the initial link, the browser redirects me to:
https://www.bpmverhuur.nlverhuur-grondverzet-minigraver-15ton-verhuur This misses the slash after the .nl How could I fix this?
Thanks in advance!
尝试这个
Redirect 301 /verhuur-grondverzet-minigraver-15ton-verhuur/ https://bpmverhuur.nl/verhuur-grondverzet-minigraver-15ton-verhuur/
The URL-path
argument for Redirect
is treated as a prefix .
Redirect 301 / https://www.bpmverhuur.nl
So this affects all requests that start with /
.
https://httpd.apache.org/docs/2.4/mod/mod_alias.html#redirect :
Then any request beginning with URL-path will return a redirect request to the client at the location of the target URL. Additional path information beyond the matched URL-path will be appended to the target URL.
This means, if /foobar
gets requested, the additional path information beyond the matched URL-path will be just foobar
. And you specified https://www.bpmverhuur.nl
as the base this should be appended to, so you end up with https://www.bpmverhuur.nlfoobar
. So you should add a trailing slash to this base, to fix that issue.
And then switch the order of your directives - so that /verhuur-grondverzet-minigraver-15ton-verhuur/
gets taken care of first. You need to go most specific first, less specific later.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.