Timeline for Two Permanent Redirects using .htaccess
Current License: CC BY-SA 3.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 13, 2017 at 12:10 | vote | accept | CuriousDev | ||
Feb 10, 2017 at 17:00 | comment | added | MrWhite |
Yes, the RewriteCond directive makes sure that the following redirect only happens when the URL does not already start /items/ . In fact, any request that contains more than one path segment (eg. /foo/bar/ ) would also be excluded, regardless of whether it contains "items".
|
|
Feb 10, 2017 at 16:51 | comment | added | MrWhite |
Not sure why you would get "items" twice like that, unless there is a conflict somewhere else (ie. WordPress)? Can you confirm that the requested URL is /items/sample-post/ ? Check the network traffic... what redirects do you see? Presumably /items/items/sample-post/ results in a 404?
|
|
Feb 10, 2017 at 11:35 | comment | added | CuriousDev | I am so glad you answered my question again :) I do not have a high traffic website. Infact it is just 300 visitors per day but these posts were created over 6 years ago. I am reviving the site. When I tried the first suggestion that is RewriteRule ^\d{4}/\d\d/\d\d/(.+) /items/$1 [R=301,L] it works for all old urls. However for the new urls with the custom post types "items" it now adds items two times making it somewebsite.com/items/items/sample-post I believe your second suggestion using RewriteCond applies only to urls not already having "items" in it right? | |
Feb 10, 2017 at 10:45 | history | answered | MrWhite | CC BY-SA 3.0 |