Blog Sections Open

Ordering Custom RewriteRules Correctly in .htaccess

A classic rewrite mistake in Evolution CMS is to add a custom route such as /groups/beer_vodka below the generic friendly URL block. When that happens, the catch-all rule intercepts the request first and your custom mapp

A classic rewrite mistake in Evolution CMS is to add a custom route such as /groups/beer_vodka below the generic friendly URL block. When that happens, the catch-all rule intercepts the request first and your custom mapping never wins.

Problem Pattern

# Friendly URLs
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

RewriteRule ^groups/([a-z_-0-9]+)$ index.php?id=360&page=$1 [QSA,L]

Correct Order

RewriteRule ^groups/([a-z_-0-9]+)$ index.php?id=360&page=$1 [QSA,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

Main Rule

Specific rewrites must come before the generic Evolution catch-all. Otherwise the request is already routed into index.php?q=... and the custom rule never gets a chance.

Why This Matters

This is not just a routing detail. Misordered rewrites can produce broken friendly URLs, false 404s, duplicate routes, and confusing SEO behavior.

Newer post

Why PHP Sessions Can Overload a Busy Evolution CMS Site

How session-heavy traffic can push CPU usage up on a VDS and what to review before blaming snippets alone.

Older post

Why WebLogin Password Reminders Fail While SMTP Still Works

How to troubleshoot WebLogin reminder emails when eForm or other SMTP-based mailers still send successfully.