Skip to content

Commit

Permalink
moved redirects to nginx config
Browse files Browse the repository at this point in the history
  • Loading branch information
rstaib committed Jan 18, 2023
1 parent 4173f63 commit 0c6b183
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 324 deletions.
119 changes: 118 additions & 1 deletion website/config/conf.d/default.conf
Expand Up @@ -5,6 +5,123 @@ server {
error_page 404 /404/index.html;

location / {
try_files $uri $uri/ =404;
rewrite ^/banana-cake-pop/?$ /products/bananacakepop permanent;
rewrite ^/company/?$ / permanent;
rewrite ^/products/?$ / permanent;
rewrite ^/services/?$ /services/support permanent;
rewrite ^/support/?$ /services/support permanent;

# fixed year in already published blog post
rewrite ^/blog/2019/03/18/entity-framework/?$ /blog/2020/03/18/entity-framework permanent;
}

location /docs {
set $latest v12;
set $hc /docs/hotchocolate/$latest;

# docs -> hotchocolate
rewrite ^/docs/?$ $hc permanent;

# marshmallowpie -> hotchocolate
rewrite ^/docs/marshmallowpie.*$ $hc permanent;

# ensures version for hc & sbs is always set
rewrite ^/docs/(hotchocolate|strawberryshake)(?!/v\d+$|/v\d+/.*)(/.*)$ /docs/$1/$latest$2 permanent;

# ensures version for bcp is always set
rewrite ^/docs/(bananacakepop)(?!/v\d+$|/v\d+\/.*)(/.*)$ /docs/$1/v2$2 permanent;

# get-started -> get-started-with-graphql-in-net-core
rewrite ^/docs/hotchocolate/(v12|v13)/get-started/?$ /docs/hotchocolate/$1/get-started-with-graphql-in-net-core permanent;

# code-first|schema|schema-first -> defining-a-schema
rewrite ^/docs/hotchocolate/(v12|v13)/(code-first|schema|schema-first)/?$ /docs/hotchocolate/$1/defining-a-schema permanent;

# schema/custom-scalar-types -> defining-a-schema/scalars
rewrite ^/docs/hotchocolate/(v12|v13)/schema/custom-scalar-types/?$ /docs/hotchocolate/$1/defining-a-schema/scalars permanent;

# schema/descriptions -> defining-a-schema/documentation
rewrite ^/docs/hotchocolate/(v12|v13)/schema/descriptions/?$ /docs/hotchocolate/$1/defining-a-schema/documentation permanent;

# schema/directives -> defining-a-schema/directives
rewrite ^/docs/hotchocolate/(v12|v13)/schema/directives/?$ /docs/hotchocolate/$1/defining-a-schema/directives permanent;

# schema/enum-type -> defining-a-schema/enums
rewrite ^/docs/hotchocolate/(v12|v13)/schema/enum-type/?$ /docs/hotchocolate/$1/defining-a-schema/enums permanent;

# schema/input-object-type -> defining-a-schema/input-object-types
rewrite ^/docs/hotchocolate/(v12|v13)/schema/input-object-type/?$ /docs/hotchocolate/$1/defining-a-schema/input-object-types permanent;

# schema/interface-type -> defining-a-schema/interfaces
rewrite ^/docs/hotchocolate/(v12|v13)/schema/interface-type/?$ /docs/hotchocolate/$1/defining-a-schema/interfaces permanent;

# schema/object-type -> defining-a-schema/object-types
rewrite ^/docs/hotchocolate/(v12|v13)/schema/object-type/?$ /docs/hotchocolate/$1/defining-a-schema/object-types permanent;

# schema/relay -> defining-a-schema/relay
rewrite ^/docs/hotchocolate/(v12|v13)/schema/relay/?$ /docs/hotchocolate/$1/defining-a-schema/relay permanent;

# schema/resolvers -> fetching-data/resolvers
rewrite ^/docs/hotchocolate/(v12|v13)/schema/resolvers/?$ /docs/hotchocolate/$1/fetching-data/resolvers permanent;

# schema/union-type -> defining-a-schema/unions
rewrite ^/docs/hotchocolate/(v12|v13)/schema/union-type/?$ /docs/hotchocolate/$1/defining-a-schema/unions permanent;

# data-fetching -> fetching-data/dataloader
rewrite ^/docs/hotchocolate/(v12|v13)/data-fetching/?$ /docs/hotchocolate/$1/fetching-data/dataloader permanent;

# data-fetching/pagination -> fetching-data/pagination
rewrite ^/docs/hotchocolate/(v12|v13)/data-fetching/pagination/?$ /docs/hotchocolate/$1/fetching-data/pagination permanent;

# data-fetching/filters -> fetching-data/filtering
rewrite ^/docs/hotchocolate/(v12|v13)/data-fetching/filters/?$ /docs/hotchocolate/$1/fetching-data/filtering permanent;

# execution-engine -> performance/persisted-queries
rewrite ^/docs/hotchocolate/(v12|v13)/execution-engine/?$ /docs/hotchocolate/$1/performance/persisted-queries permanent;

# execution-engine/apollo-tracing -> server/instrumentation#apollo-tracing
rewrite ^/docs/hotchocolate/(v12|v13)/execution-engine/apollo-tracing/?$ /docs/hotchocolate/$1/server/instrumentation#apollo-tracing permanent;

# execution-engine/custom-context-data -> execution-engine
rewrite ^/docs/hotchocolate/(v12|v13)/execution-engine/custom-context-data/?$ /docs/hotchocolate/$1/execution-engine permanent;

# execution-engine/instrumentation -> server/instrumentation
rewrite ^/docs/hotchocolate/(v12|v13)/execution-engine/instrumentation/?$ /docs/hotchocolate/$1/server/instrumentation permanent;

# execution-engine/persisted-queries -> performance/persisted-queries
rewrite ^/docs/hotchocolate/(v12|v13)/execution-engine/persisted-queries/?$ /docs/hotchocolate/$1/performance/persisted-queries permanent;

# execution-engine/subscriptions -> defining-a-schema/subscriptions
rewrite ^/docs/hotchocolate/(v12|v13)/execution-engine/subscriptions/?$ /docs/hotchocolate/$1/defining-a-schema/subscriptions permanent;

# execution-engine/type-conversion -> defining-a-schema/scalars#custom-converters
rewrite ^/docs/hotchocolate/(v12|v13)/execution-engine/type-conversion/?$ /docs/hotchocolate/$1/defining-a-schema/scalars#custom-converters permanent;

# security/security -> security
rewrite ^/docs/hotchocolate/(v12|v13)/security/security/?$ /docs/hotchocolate/$1/security permanent;

# stitching -> distributed-schema
rewrite ^/docs/hotchocolate/(v12|v13)/stitching/?$ /docs/hotchocolate/$1/distributed-schema permanent;

# tutorials -> integrations/entity-framework
rewrite ^/docs/hotchocolate/(v12|v13)/tutorials/?$ /docs/hotchocolate/$1/integrations/entity-framework permanent;
}

location /img/projects {
# green donut
rewrite ^/img/projects/greendonut-banner.svg$ /resources/greendonut-banner.svg permanent;
rewrite ^/img/projects/greendonut-signet.svg$ /resources/greendonut-signet.svg permanent;

# hot chocolate
rewrite ^/img/projects/hotchocolate-banner.svg$ /resources/hotchocolate-banner.svg permanent;
rewrite ^/img/projects/hotchocolate-signet.svg$ /resources/hotchocolate-signet.svg permanent;

# react rasta
rewrite ^/img/projects/react-rsata-banner.svg$ /resources/react-rsata-banner.svg permanent;
rewrite ^/img/projects/react-rsata-signet.svg$ /resources/react-rsata-signet.svg permanent;

# strawberry shake
rewrite ^/img/projects/strawberryshake-banner.svg$ /resources/strawberryshake-banner.svg permanent;
rewrite ^/img/projects/strawberryshake-signet.svg$ /resources/strawberryshake-signet.svg permanent;
}
}

0 comments on commit 0c6b183

Please sign in to comment.