Skip to content

Instantly share code, notes, and snippets.

@knice
Created September 18, 2023 17:26
Show Gist options
  • Save knice/63939c167401e4698005622c20655b94 to your computer and use it in GitHub Desktop.
Save knice/63939c167401e4698005622c20655b94 to your computer and use it in GitHub Desktop.
htaccess for www
<ifModule mod_headers.c>
Header set Connection keep-alive
# Cache time of 21 days (21*60*60*24)
<FilesMatch "\.(js|css)$">
Header set Cache-Control "max-age=1814400"
</FilesMatch>
# Cache time of 60 days (60*60*60*24)
<FilesMatch "\.(ico|svg)$">
Header set Cache-Control "max-age=5184000"
</FilesMatch>
<FilesMatch "\.(jpeg|jpg|png)$">
Header set Cache-Control "max-age=2592000"
</FilesMatch>
</IfModule>
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE image/vnd.microsoft.icon
</IfModule>
RewriteEngine On
###
### Redirect "index.html" URLs to their directory root.
### This prevents duplicates in search engine indexes
###
RewriteRule ^index.html$ / [R=301,L]
RewriteRule ^(.*)/index.html$ /$1/ [R=301,L]
###
### Do not edit above this area
###
##
## Removed content
##
Redirect gone /photocontest
Redirect gone /areyouyellow
Redirect gone /silicon-valley
Redirect gone /features/original/
##
## Change this for campus status and advisories
##
RewriteRule ^(advisory|status|strike)\/?$ https://status.ucsc.edu
RewriteRule ^fire\/service-status.html$ https://status.ucsc.edu
RewriteRule ^fire\/(index.html)?$ https://status.ucsc.edu
##
## Maps and feedback forms
##
RedirectMatch 301 ^/maps(|\/)$ https://maps.ucsc.edu
RedirectMatch 301 ^/map(|\/)$ https://maps.ucsc.edu
RedirectMatch 301 ^/feedback\/index\.html\/$ https://www.ucsc.edu/feedback/
RedirectMatch 301 ^/(feedbackform)(|\/)$ https://forms.gle/vrygCdPGGpcbk5Wf9
##
## COVID-19 & recovery.ucsc.edu
##
RewriteRule ^keepteaching(|\/)$ https://sites.google.com/ucsc.edu/keep-teaching-ucsc/
RewriteRule ^keeplearning(|\/)$ https://sites.google.com/ucsc.edu/keep-learning/
RewriteRule ^recovery\/?$ https://slugstrong.ucsc.edu
RewriteRule ^2021dataevent\/?$ https://www.ucsc.edu/accellion-data-event/
RewriteRule ^2021-data-event\/?$ https://www.ucsc.edu/accellion-data-event/
RedirectMatch 301 ^/coronavirus/social-distancing-protocol.html$ https://recovery.ucsc.edu/returning-to-campus/do-your-part/#social-distancing-protocol
RedirectMatch 301 ^/coronavirus/symptom-check.html$ https://recovery.ucsc.edu/returning-to-campus/checking-for-symptoms/
RedirectMatch 301 ^/coronavirus/updates.html$ https://recovery.ucsc.edu/news-and-updates/
RedirectMatch 301 ^/coronavirus\/index.html$ https://recovery.ucsc.edu
RedirectMatch 301 ^/covid-?19(.*)$ https://www.ucsc.edu/coronavirus/
RedirectMatch 301 ^/(highlights\/?)$ https://news.ucsc.edu/2021/12/year-in-review/
RedirectMatch 301 ^/about/administration.html$ https://www.ucsc.edu/about/leadership.html
## Redirect to org charts
RedirectMatch 301 ^/about/files/(academic-org-chart|admin-org-chart).pdf /about/files/ucsc-organization-chart.pdf
RedirectMatch 301 ^/academics/download/Acad_Org_Chart.pdf /about/files/ucsc-organization-chart.pdf
RedirectMatch 301 ^/academics/files/academic-org-chart.pdf /about/files/ucsc-organization-chart.pdf
## Redirects to other places on WWW
RedirectMatch 301 ^/research/research-news.html$ https://www.ucsc.edu/research/news.html
RedirectMatch 301 ^/jobs(|\/)$ https://www.ucsc.edu/about/employment.html
RedirectMatch 301 ^/principles(|\/)$ https://www.ucsc.edu/about/principles-community.html
RewriteRule ^land-acknowledgement\/?$ https://www.ucsc.edu/land-acknowledgment/
## Permanent redirects to other sites
RedirectMatch 301 ^/(campus-climate|campusclimate)(.*)$ https://campus-climate.ucsc.edu$2
RewriteRule ^thepringgivetoolkit\/?$ https://sites.google.com/ucsc.edu/the-spring-give-tool-kit/home
RewriteRule ^innovation\/?$ https://innovation.ucsc.edu
RewriteRule ^alumni-?week\/?$ https://alumniweekend.ucsc.edu
RewriteRule ^classof2020(|\/)$ https://classof2020.ucsc.edu/profiles/
RewriteRule ^news_events/press(|\/)$ https://news.ucsc.edu/%{TIME_YEAR}/press_releases_page.html
RewriteRule ^can(|\/)$ https://alumni.ucsc.edu/programs-services/can/index.html
RewriteRule ^trustees(|\/)$ http://foundation.ucsc.edu/news-events/events/trustee-reunion.html
RewriteRule ^givingdaytoolkit(|\/)$ https://ucsc-communications.atlassian.net/wiki/display/GD/Giving+Day+2017
RewriteRule ^cucrc(|\/)$ http://deanofstudents.ucsc.edu/get-involved/dos-events/cucrc.html
RewriteRule ^codeofconduct(|\/)$ http://deanofstudents.ucsc.edu/student-conduct/student-handbook/pdf/100.0-code-of-student-conduct.pdf
RewriteRule ^makeagift(|\/)$ https://secure.imodules.com/s/1069/index-2-column.aspx?sid=1069&gid=1&pgid=761&cid=1722
RewriteRule ^features\/silicon-valley(|\/|\/index\.html)$ http://siliconvalley.ucsc.edu [L,R=301]
RewriteRule ^loveonhaight(|\/|\/index\.html)$ http://exhibits.library.ucsc.edu/exhibits/show/love-on-haight
RewriteRule ^haha(|\/|\/index\.html)$ https://securelb.imodules.com/s/1069/index.aspx?sid=1069&gid=1&pgid=780&dids=823&bledit=1
RewriteRule ^eventsemail(|\/|\/index\.html)$ https://ucscforms.wufoo.com/forms/uc-santa-cruz-events-email/
RewriteRule ^collegesigningday(|\/|\/index\.html)$ https://docs.google.com/forms/d/1Oa8FfXo2pq3SWdoI3E1P6v2h7cIzA_pRwKRZjVXvUAg/viewform?ts=5c9267b4&edit_requested=true
RewriteRule ^collegesigningday(|\/)$ https://docs.google.com/forms/d/1Oa8FfXo2pq3SWdoI3E1P6v2h7cIzA_pRwKRZjVXvUAg/viewform?ts=5c9267b4&edit_requested=true
RewriteRule ^covidresearch\/?$ https://officeofresearch.ucsc.edu/covid-19/research-projects.html
RewriteRule ^stay-?connected\/?$ https://connect.ucsc.edu/s/1069/bp18/interior.aspx?sid=1069&gid=1001&pgid=549&cid=1353&post_id=0
RedirectMatch 301 ^/knowyourrights\/?$ https://eop.ucsc.edu/undocumented_student_services/immigration-legal-services/know_your_rights.html
RedirectMatch 301 ^/casfs\/?$ https://casfs.ucsc.edu
## Permanent redirects to other sites (C&M)
RewriteRule ^about/crime-stats(.*)?$ https://police.ucsc.edu/crime-prevention/clery.html
RewriteRule ^webtools(|\/)$ http://ucsc.github.io/web-tools/
RewriteRule ^currents\/(.*)$ http://currents.ucsc.edu/$1
RewriteRule ^storycruz(|\/)$ https://soundcloud.com/ucsantacruz/sets/storycruz
RewriteRule ^about/achievements/awards(|\/)$ http://news.ucsc.edu/awards/
RewriteRule ^slugsabroad(|\/)$ http://ucsc-horizons.symplicity.com
RewriteRule ^shw(|\/)$ https://ucscstudenthousingwest.org
RewriteRule ^parents\/parents-fund\.html$ https://orientation.ucsc.edu/parents/parents-fund.html?ref=parents-home
RewriteRule ^parents(\/|\/index.html)$ https://families.ucsc.edu
RewriteRule ^bettertogether(|\/)$ https://www.ucsc.edu/better-together
## Permanent redirects to communications.ucsc.edu (C&M)
RewriteRule ^identity/(.*) https://communications.ucsc.edu
## Permanent redirects to transform.ucsc.edu (Institute for Social Transformation)
RewriteRule ^santacruzinstitute\/? https://transform.ucsc.edu
## Short URL links to other UCSC sites
RewriteRule ^calendar(|\/)$ https://events.ucsc.edu
RewriteRule ^chancellor(|\/)$ https://chancellor.ucsc.edu
RewriteRule ^commencement(|\/)$ https://specialevents.ucsc.edu/commencement/
RewriteRule ^farmandgarden(|\/)$ https://casfs.ucsc.edu/
RewriteRule ^library(|\/|\/index.html)$ https://library.ucsc.edu
RewriteRule ^news(|\/)$ https://news.ucsc.edu
RewriteRule ^vote(|\/)$ https://urelations.ucsc.edu/about/units/government/vote/
RewriteRule ^seo(|\/)$ https://urelations.ucsc.edu/units/special-events/
RewriteRule ^video(|\/)$ https://news.ucsc.edu/video
RewriteRule ^give-ucscfund(|\/)$ https://secure.ucsc.edu/s/1069/index.aspx?sid=1069&gid=1&pgid=761&dids=12
RewriteRule ^science(|\/)$ https://pbsci.ucsc.edu
RewriteRule ^mobile(|\/|\/mobile_apps.html)$ https://www.ucsc.edu/ [R=302,L]
RewriteRule ^justicereform(|\/)$ https://specialevents.ucsc.edu/criminal-justice-reform
RewriteRule ^kraw(|\/)$ https://specialevents.ucsc.edu/kraw-lecture/index.html
RewriteRule ^cowell-closure(|\/)$ https://news.ucsc.edu/2019/03/cowell-closure-updates.html
RewriteRule ^rubinchair(|\/)$ https://crowdfund.ucsc.edu/?cfpage=project&project_id=27520
RewriteRule ^resilient(|\/)$ https://healthycampus.ucsc.edu/wellness-initiatives/radical-resilience/
## Redirects for events
RewriteRule ^printsale(|\/)$ http://artsites.ucsc.edu/printsale/
RewriteRule ^tonyhill(|\/)$ http://specialevents.ucsc.edu/mlk/tony-hill-award-nomination.html
RewriteRule ^maitra(|\/)$ http://specialevents.ucsc.edu/maitra
RewriteRule ^mlk(|\/)$ http://specialevents.ucsc.edu/mlk
RewriteRule ^krawlecture(|\/)$ http://specialevents.ucsc.edu/kraw-lecture
RewriteRule ^openhouse(|\/)$ https://specialevents.ucsc.edu/founders/day-events-tours.html
## Redirects for marketing initiatives
RewriteRule ^nontraditional(|\/)$ http://www.ucsc.edu?utm_source=podcast&utm_medium=audio&utm_campaign=audio-mention
RewriteRule ^whosays(|\/)$ http://50years.ucsc.edu/whosays/?utm_source=redirect&utm_medium=print&utm_campaign=whosays
RewriteRule ^annual-report(|\/)$ http://giving.ucsc.edu/reports/
RewriteRule ^podcasts(|\/)$ http://podcasts.ucsc.edu
RewriteRule ^chancellorsassociates(|\/)$ https://giving.ucsc.edu/ways-to-give/chancellors-associates/
RewriteRule ^housing(|\/)$ https://www.ucsc.edu/better-together/addressing-housing-insecurity/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment