Published on

Working with multiple tools This URL Redirection system improved our productivity

Authors

It was a simple website with a blog, but there were no real hooks for using other web apps (like WordPress, Drupal, etc.) to interact with the site.

We needed a way to quickly create custom content types for our site and then view and modify that content through a dynamic web application. Our approach was to use the local file system to create and edit content and then manually transfer the files to the server.

But this was a tedious process and hard to scale.

We needed a way to automate the web app creation process.

And that's where this URL Redirection system came in.

CMS Back-end

The basic premise behind our implementation was to use a CMS back-end with URL Redirection. This would allow us to not only create custom content types, but also allow us to interact with those custom content types from a web application.

The CMS back-end would be hosted on the same server as the main website, and the URL Redirection would be used to send the user to the appropriate web app.

For example, if a user were to visit site.com/blog/post-x, the URL Redirection system would detect that the request was for a blog post and redirect the user to the appropriate web app to edit that post.

This is a simple example, but the workflow would be the same for all types of content.

The CMS Back-end

Our CMS back-end was a combination of two open source projects:

The first project is a front-end to the WordPress REST API. This project allows us to create a rich, front-end experience for the web application.

The second project is a PHP library for interacting with the WordPress REST API. This project allows us to use the WordPress REST API as a backend for our web application.

The two projects combined are a complete CMS back-end.

The URL Redirection system uses the WordPress REST API to detect the page being requested and then redirect the user to the correct web app.

A Workflow Example

The workflow we used was fairly simple.

Upon request, the API would detect the page being requested, determine the type of content, and then redirect the user to the appropriate web app.

The API would be used to create and edit content.

A sample workflow can be seen below.

The API would be used to create and edit content.

The front-end would be used to view content.

The process of creating and editing content could be seen in the following workflow.

Create a new custom content type Create a new post for the content type. Edit the post using the front-end. Send the post to the API. Edit the post using the API. Send the post to the front-end.

The flow of creating and editing content can be seen below.

The workflow was fairly simple, but we wanted to make sure that it was as easy to use as possible.

The API

The API was a REST API that was used to create and edit content.

The API was created with the WordPress REST API. We used the WordPress REST API as it is the recommended interface for creating and editing content.

The API was used for the following purposes:

Create a new custom content type Create a new post for the content type. Edit the post using the front-end. Send the post to the API. Edit the post using the API. Send the post to the front-end.

The API was used to create and edit content.

The PHP Library

The PHP library was a REST API client that was used to interact with the WordPress REST API.