Forum

Redirect "/~$USER/unsorted/*" to "/~$USER/*" on a *different domain?

Tay
11 December 2018, 18:51
I'm currently transitioning my archives server (basically just a place for the downloads folder to get rotated to, haha) over to a new URL form, with an eye towards divorcing it from the main website server.

The old format was:
http://www.example.com/~${USER}/unsorted/$(date '+%Y/%m')/${filename}
(that is, it was PREVIOUSLY just a folder called "unsorted", inside the regular user-website folder.)

But my new format is:
https://archive.example.com/~$USER/$(date '+%Y/%m')/$filename
(so, NOW, it's the date-based folders right at the user's top level, on the archive server or vhost.)

how can I blanket-redirect this folder from the old TLD, to the new TLD?
Tay
11 December 2018, 18:53
The inscrutable "Error while including" message was yielded for the following UrlToolkit entry:
UrlToolkit {
ToolkitID = userUnsorted404Archive
RequestURI exists Return
Match ^/(\~+*)/unsorted/(.*) Redirect https://archive.example.com/$1/$2
}
Tay
11 December 2018, 19:04
So, to be explicit,

My goal is for (e.g.) (and with my regrettably inconsistently-tokenized URL templates converted to here to "concrete examples"):

http[s​]://[www.​]example.com/~samblam86/unsorted/2005/03/MEME.GIF

to

https://archive.example.com/~samblam86/2005/03/MEME.GIF

preferably with a 301
Tay
11 December 2018, 19:26
It turns out the "Error while including" message was due to another file, upon closer inspection.

But, this is still not quite working as I'd think:

despite the Return directive,
UrlToolkit {
ToolkitID = userUnsorted404Archive
RequestURI exists Return
Match ^/(~.+)/unsorted/(.*) Redirect https://archive.example.com/$1/$2
}
it's still redirecting even a test-existent file. (I tried a few runs of hitting the URL, removing the UrlToolkit entry, hitting it again, re-adding it; to rule out any problems with 301s being cached)

How can I ensure that "RequestURL exists Return" will return the file (rather than proceeding with rewriting the URL into a redirect) when it exists?
This topic has been closed.