RewriteEngine On

# moved to /docs/
RewriteRule ^faq(.*) /docs/faq$1 [R=301,L]
RewriteRule ^bridges(.*) /docs/bridges$1 [R=301,L]
RewriteRule ^abuse(.*) /docs/abuse$1 [R=301,L]
RewriteRule ^documentation(.*) /docs/documentation$1 [R=301,L]
RewriteRule ^verifying-signatures(.*) /docs/verifying-signatures$1 [R=301,L]
RewriteRule ^tor-manual(.*) /docs/tor-manual$1 [R=301,L]

# Torbutton
RewriteRule ^torbutton/design(.*) /docs/torbutton/en/design$1 [R=301,L]
RewriteRule ^torbutton/(.*) /docs/torbutton/$1 [R=301,L]

# Tor Browser
RewriteRule ^torbrowser/dist/(.*) /dist/torbrowser/$1 [R=301,L]
#RewriteRule ^torbrowser/$ /projects/torbrowser.html.en [R=301,L]
RewriteRule ^torbrowser(.*) /projects/torbrowser.html.en [R=301,L]

# tordnsel
RewriteRule ^tordnsel/dist/(.*) /dist/tordnsel/$1 [R=301,L]

# Overview
RewriteRule ^overview(.*) /about/overview$1 [R=301,L]

# Press
RewriteRule ^press/$ /press/press [R=301,L]
RewriteRule ^press/index.html(.*) /press/press.html$1 [R=301,L]

# Projects
RewriteRule ^projects/$ /projects/projects [R=301,L]

#Pluggable Transports
RewriteRule ^PT/?$ /docs/pluggable-transports [R=301,L]
RewriteRule ^projects/obfsproxy-debian-instructions(.*) /docs/pluggable-transports [R=410,L]
RewriteRule ^projects/obfsproxy-instructions(.*) /docs/pluggable-transports [R=410,L]
RewriteRule ^projects/obfsproxy(.*) /docs/pluggable-transports [R=301,L]

#Relays
RewriteRule ^relay-guide(.*) https://trac.torproject.org/projects/tor/wiki/TorRelayGuide [R=301,L]

# GetInvolved
RewriteRule ^getinvolved/$ /getinvolved/volunteer [R=301,L]
RewriteRule ^volunteer(.*) /getinvolved/volunteer$1 [R=301,L]
RewriteRule ^tshirt(.*) /getinvolved/tshirt$1 [R=301,L]

RewriteRule ^research(.*) https://research.torproject.org/ [R=301,L]
RewriteRule ^getinvolved/research(.*) https://research.torproject.org/ [R=301,L]

# Support
RewriteRule ^support(.*) https://trac.torproject.org/projects/tor/wiki/org/teams/CommunityTeam/Support [R=301,L]

# Newsletter
RewriteRule ^newsletter(.*) https://newsletter.torproject.org [R=301,L]

# other (feel free to categorize)
RewriteRule ^people(.*) /about/corepeople$1 [R=301,L]
RewriteRule ^donate/$ https://donate.torproject.org [R=302,L]
RewriteRule ^contact(.*) /about/contact$1 [R=301,L]

# Download websites
RewriteRule ^download/$ /download/download [R=301,L]
RewriteRule ^download.html(.*) /download/download.html$1 [R=301,L]
RewriteRule ^easy-download(.*) /download/download$1 [R=301,L]
RewriteRule ^download-easy(.*) /download/download$1 [R=301,L]
RewriteRule ^download-unix(.*) /download/download$1 [R=301,L]
RewriteRule ^tor(.*) /download/download [R=301,L]

# Relays
RewriteRule ^relays(.*) /getinvolved/relays [R=301,L]

# Index Pages
RewriteRule ^about/$ /about/overview [R=301,L]
RewriteRule ^cgi-bin/$ / [R=301,L]
RewriteRule ^css/$ / [R=301,L]
RewriteRule ^docs/$ /docs/documentation [R=301,L]
RewriteRule ^eff/$ / [R=301,L]
RewriteRule ^en/$ / [R=301,L]
RewriteRule ^images/$ / [R=301,L]
RewriteRule ^include/$ / [R=301,L]
RewriteRule ^js/$ / [R=301,L]

# Donation campaign
# 2017
# Special-case the donate-options and amazon page so it doesn't get redirected
RewriteRule ^donate/donate-options(.*) /donate/donate-options$1 [END]
RewriteRule ^donate/donate-amazon(.*) /donate/donate-amazon$1 [END]
RewriteRule ^donate/donate(.*) https://donate.torproject.org [R=302,L]
RewriteRule ^donate/donor-faq(.*) https://donate.torproject.org/donor-faq [R=302,L]
RewriteRule ^donate/donor-privacy-policy(.*) https://donate.torproject.org/privacy-policy [R=302,L]
RewriteRule ^donate/thankyou(.*) https://donate.torproject.org/thank-you [R=302,L]
RewriteRule ^thankyou(.*) https://donate.torproject.org/thank-you [R=302,L]

# The following redirect is necessary because we're using that URL on
# some external resources (the donate infrastructure in particular) and
# getting it changed there is apparently hard or something.
RewriteRule ^donate-email(.*) https://donate.torproject.org/ [R=302,L]