Friendly URLs on Apache
Last updated Dec 12th, 2019 | Page history | Improve this page | Report an issue
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$311 per month—let's make that $500!
Learn moreBy default, MODX ships with a ht.access
file in the root that serves as an example for using friendly URLs on Apache servers.
To use it, rename the file ht.access
to .htaccess
.
Required .htaccess rules¶
While the example ht.access
file contains different optimisations, for friendly URLs you only need the following.
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
Subdirectory installations¶
If your MODX is installed in a subdirectory, change the RewriteBase
accordingly.
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$311 per month—let's make that $500!
Learn more