Simple Navigator Snippet for ModX Revolution
I found myself needing a really simple way to pull in my sites menu, but also wanted the ability to have some placeholders for the links as well. The following code should be created as a snippet, and called un-cached [[!YOUR_SNIPPET_NAME]] What's it do? Well, simply put it generates a….Net DataReader Wrapper
UPDATE 2.0!!! Wow, just realized it's been awhile since i posted anything... well kiddies, time for some new code. Although I have grown up loveing, carressing, and mutilating Visual Basic, I have decided to take a stab at some C# since most of my projects lately have comes across in…Moving a ModX Revolution Site to Another Server
Since I am currently running into this issue right now as I type this, I though I would share my experiences with moving a ModX Revolution site from one server to another. It is not an easy task, but can be accomplished rather easily. The first thing you will need…ModX Revolution Friendly URLs
I have become quite the ModX lover lately, I use it to run 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…Cookie Notice
This site utilizes cookies to improve your browsing experience, analyze the type of traffic we receive, and serve up proper content for you. If you wish to continue browsing, you must agree to allow us to set these cookies. If not, please visit another website.
ModX Revolution Friendly URLs
I have become quite the ModX lover lately, I use it to run 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:
RewriteEngine On RewriteBase / ErrorDocument 404 /page-not-found # for now, set the default document to index.htm # DirectoryIndex index.htm index.php # The Friendly URLs part - for normal pages RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NC] # caching static files <IfModule mod_headers.c> <FilesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|bmp|js|css|swf|woff|svg|ttf|otf|eot)(.gz)?$"> # To Prevent Caching #Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate" #Header set Pragma "no-cache" #Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT" # Cache Header unset Pragma Header unset ETag Header set Cache-Control "max-age=31556000, store, cache" Header unset Last-Modified Header set Connection keep-alive Header add X-PoweredBy "o7th Web Design ~ Real Design, Real Development, by Real People ~ " </FilesMatch> </IfModule> FileETag None <IfModule mod_expires.c> ExpiresActive On ExpiresDefault "access plus 1 seconds" ExpiresByType text/html M31556000 ExpiresByType image/gif M31556000 ExpiresByType image/jpeg M31556000 ExpiresByType image/png M31556000 ExpiresByType text/css M31556000 ExpiresByType text/javascript M31556000 ExpiresByType application/javascript M31556000 ExpiresByType application/x-javascript M31556000 ExpiresByType text/xml M31556000 ExpiresByType image/svg+xml M31556000 ExpiresByType application/x-font-ttf M31556000 ExpiresByType application/x-font-truetype M31556000 ExpiresByType application/x-font-opentype M31556000 ExpiresByType application/vnd.ms-fontobject M31556000 ExpiresByType application/x-font-woff M31556000 </IfModule> # For servers that support output compression, you should pick up a bit of # speed by un-commenting the following lines. php_flag zlib.output_compression On php_value zlib.output_compression_level 9
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.+
~Kevin