I have become quite the ModX lover lately, I use it to run my site, as well as a great number of client websites and find that it is extremely speedy, easy to use (from my perspective), and easy to teach.
There are a few things I don’t like about it, but this post is not about that (well… at least not all of them :)). This post is about SEO and URL Friendliness.
Now ModX has a great built-in way to allow us to have friendly URLs for our content resources, however, by default all HTML content pages are given the .html extension. While this normally is not a big deal, I am a bit of a stickler when it comes to my URL’s. I like them with no extension what-so-ever.
So… after much digging around in my site’s settings, I finally figured out how to take care of this. Here are the steps I took, hopefully it will help you accomplish the same thing.
First and foremost, after you install ModX on your server, make sure to create or update your existing .htaccess file:
Now, as you can see it put in a few extras for you, these are to help speed up for site, ensure caching, etc… the main lines to look for in here are the re-write rules. You will notice that we are taking every page request, and sending the to the ModX processor.
Now, the next step to take is to of course turn on the Friendly URLs in our ModX manager, so go ahead and login and get to your ‘System Settings‘ page. Once there, select ‘Friendly URL‘ from the “Filter by area...” drop-down.
Look for “Use Friendly URL” and change the setting to “Yes“. I would go a couple steps further here and make sure that the system checks for duplicates, and uses Alias Path.
Once you do that, head over to your ‘System‘ menu once again, and click on ‘Content Types‘. Now, the default content type for all resource pages is HTML (text/html), so look for HTML, and under “File Extension“, delete out the .html and hit save.
Clear your ModX cache, Remove All Locks, and then browse your site, all your URL’s should now be extensionless 🙂
Hope this helps, and as always… happy coding!
Please note, this has only been tested in ModX Revolution, 2.+