Managing URLs and redirects with Ibexa DXP
HTTP (Hypertext Transfer Protocol) is the foundation of the web. It's a protocol that is used to transfer data such as documents and images to your browser. In addition to piping bits, it allows communicating the status of requested data. Commonly used HTTP status codes are 200 (OK) and 404 (Not Found). Another one is 301 (Moved Permanently) that signals something has changed address. Let's learn how to use 301 Redirects with Ibexa DXP for optimal User Experiences and good SEO rankings.
Ibexa DXP is built on the Symfony framework that has HTTP as its heart. All inbound HTTP requests receive a standard HTTP response with the appropriate status code. This makes for a solid foundation to build applications that handle communications by the book. Ibexa DXP adds a lot functionality regarding content routing with human readable URLs, but also for managing redirects when renaming content and more.
With the technical foundation we've been able to build robust and easy-to-use URL and redirect management capabilities into our unified administration interface.
Understanding automatically generated URLs
A URL is the address to a resource on the internet. You can think of URL being formed from the protocol, the host and the path. As an example consider the following URL:
It is formed from the following components:
- Protocol: HTTPS (Secure HTTP)
- Hostname: www.example.com
- Path: /stories/how-wearable-technology-is-helping-scientists
For browser accessible URLs the protocol is always HTTP(S). The hostname comes from the domain your organization handles and has chosen to use as part of their online presence. The third part is managed by the application powering your website. Quite commonly it is a pretty-URL as they are user and SEO friendly, but it could also be something more cryptic looking, for example /cgi/stry?_drc=1&_ct=2&_cid=3353
Ibexa DXP automatically manages a list of pretty URLs for every item within the content repository. Each content item comes with its own snippet in the URL, those are then constructed into complete paths. For the example URL discussed above, the path for Ibexa DXP would be comprised of the following snippets in a tree structure:
This process is completely automatic for all content items and their translations being edited via the administration interface. It also applies to content migration processes where you're inserting data into the repository with the APIs included in Ibexa DXP.
As an added bonus Ibexa DXP automatically creates redirects when content items are renamed or moved around within the site structure over time.
Creating custom URLs and wildcards
Most of the content or products you have will likely fall in the range of automatic management. But there is still room for manually created aliases or redirects. For example, when creating short URLs for campaigns or redirecting URLs when migrating from another system to Ibexa DXP.
The repository item level URLs can be managed via the URL tab. You can view (but not edit) all of the automatically generated System URLs as well as custom URL Aliases. To modify System URLs you need to modify the content item and edit the field the snippet is generated from. To create a new custom URL click "Add new":
Fill the URL field, language and SiteAccess fields to match the settings you wish the URL to match (site language, etc.). Upon creation you will see the new URL listed under the Custom URL Aliases section:
Visitors now accessing the URL https://www.example.com/wearable-technology will be redirected to the full URL instantly. The Redirect 301 message will also signal Google and other search engines that the short URL is just a reference to the full URL and will not index the same content twice.
For more flexible redirects you can use the URL wildcards feature in Ibexa DXP. It allows matching redirects based on patterns, for example for redirecting all paths with /blog/* to their /stories/* equivalents:
This can be very useful for creating redirects for sites moving from another system to Ibexa DXP, or when you're merging your blog from a separate site to your main site. You can populate the database tables using the APIs to include hundreds of aliases without manually entering each one through the user interface.