Pretty URLs
Learn how to setup pretty URLs for your CMS Collections.
Clean URL Redirection & Routing with .htaccess
Option 1: Single Route (e.g. /post/ only)
.htaccess Example:
RewriteEngine On
# 1. Redirect /post/?slug=some-post to /post/some-post/
RewriteCond %{THE_REQUEST} \s/post/\?slug=([^&\s]+) [NC]
RewriteRule ^post/$ /post/%1/ [R=301,L]
# 2. Internally rewrite /post/some-post/ to /post/index.php?slug=some-post
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^post/([^/]+)/?$ /post/index.php?slug=$1 [L,QSA]How it works:
Option 2: Multi-Route Support (e.g. /post/, /notes/, /blog/, etc.)
.htaccess Example:
How it works:
Example Requests:
Notes and Best Practices
Debugging Tips
Last updated
Was this helpful?

