Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You can modify your regex to only match when it's not a shortened url - then the short one will redirect to the real www.reddit.com address, before the redirect matches.

(Don't have the correct regex on hand right now, as I changed browsers and decided to use Old reddit redirect extension instead of scripting, but it worked in my previous browser)



My current regex looks like this:

  ^(\w*)://www.reddit.com/(?!r/[^/]*/s/|media|gallery|notifications|appeals)(.\*)
Mapping to

  $1://old.reddit.com/$2




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: