Redirects and Rewrite Rules Comes to Webpop

Mathias Biilmann

One of the common questions from both long time clients and new Webpop users is how to do redirects for their Webpop sites.

So far the answer has been to use an extension, and that's generally gotten the job done, but it's such a common functionality that we've always felt we should have this as a built in feature.

Today the day has come to finally push our built-in support for both redirects and rewrite rules.

We’ve been thinking long and hard about how to support both redirects and rewrite rules in a straight forward way. Making sure that the most typical use case (redirecting a bunch of old paths to new paths) is as simple as possible, without giving up on more advanced use cases.

While developing the feature we've been analysing all the rewrite extension people have made for their projects, to figure out what kind of use cases we needed to support. The result of this is a new text file format for defining rewrite rules and redirects.

Here’s a commented example of a rewrites file with a bit of everything thrown in for good meassure:

# Redirect from /news to /blog
/news   /blog

# Redirect /google to google

# Redirect from /store to /temporarily-disabled with a 302
/store  /temporarily-disabled  302

# Redirect URLs like /news/2004/2/12/a-blogpost to /blog/a-blogpost
/news/:year/:month/:day/:slug  /blog/:slug

# Redirect URLs like /blog?slug=a-blogpost to /blog/a-blogpost
/blog slug=:slug /blog/:slug

# Redirect anything under /news to start with /blog instead of /news
/news/*  /blog/:splat

# Rewrite any url under /angular/... to use the same path but display /angular.html
/angular/*  /angular.html  200

To add rewrite rules, just go to your project dashboard and select the redirects tab, then type in your redirects in the text box.

Read the full docs here.

« Back to Blog Index

Sign up now

30 days free trial. Sign up in 60 seconds. Upgrade, downgrade, cancel at any time.
blog comments powered by Disqus