Description
The original URLs cannot be correctly redirected:
Proposed Solution
If we can detect the cookies of user(which store user's preferred major_code and enrollment_year), and the course code (i.e. EE1018) exists in the path, we will redirect user to the course page.
Otherwise, we will redirect the user to the latest available year where the course page exist.
For example:
If we stored the user's cookie https://hoa.moe/docs/2019/040201 before, and https://hoa.moe/docs/2019/040201/sophomore-autumn/EE1018 exists, we will redirect https://hoa.moe/docs/fresh-spring/ee1018 to https://hoa.moe/docs/2019/040201/sophomore-autumn/EE1018
Otherwise, we will find the latest year that EE1018 is available, and redirect the user to that page when he clicks the original link.
Description
The original URLs cannot be correctly redirected:
/docs/<semester>/<course_code>)/docs/<enrollment_year>/<major_code>/<semester>/<course_code>)Proposed Solution
If we can detect the cookies of user(which store user's preferred major_code and enrollment_year), and the course code (i.e. EE1018) exists in the path, we will redirect user to the course page.
Otherwise, we will redirect the user to the latest available year where the course page exist.
For example:
If we stored the user's cookie https://hoa.moe/docs/2019/040201 before, and https://hoa.moe/docs/2019/040201/sophomore-autumn/EE1018 exists, we will redirect https://hoa.moe/docs/fresh-spring/ee1018 to https://hoa.moe/docs/2019/040201/sophomore-autumn/EE1018
Otherwise, we will find the latest year that EE1018 is available, and redirect the user to that page when he clicks the original link.