You can have friendly URLs fully functioning in under two minutes by following a simple four step process:
MODx supplies an ht.access file for you to edit to match your server settings. This file will be ignored by the server until you rename it to .htaccess. The .htaccess file can be anywhere above the MODx installation but the usual location is in the MODX site root (where the Manager directory is). You can also simply create your own .htaccess file in any text editor, paste in the following code, save it in the MODX site root, and edit it accordingly:
- change the DOMAINNAME to your domain name in lowercase.
For me: shawnwilkerson
- change the TLD to the com, net, org, info, whatever you have
For me: com
/htdocs is fine or /public_html or what ever. your server uses
The .htacess has to be at the same level as the main index.php or above the document MODx is presenting.
|Be aware some control panels like to write their own .htaccess just above the site level so the best place to put it is where the home page of the site points to (view image above)|
|The RewriteBase should end with a / for root installations
The RewriteBase for a subdirectory installation should be entered as: RewriteBase /subdirectoryName although it is normally only necessary on localhost.
This works fine for Redhat Linux 5 / Apache setups. If it is not working for you contact your hosting provider -- send them this code and ask them what you need to get it working. The majority of comments have been removed and most of what remains is not required for Friendly URLS to function.
Next change the settings in the Friendly URLs Area of the System Settings in the System menu of the Revolution Manager to something like the following image indicates.
|If you do not see all of Revolution's FURL settings, simply change the "Area" drop-down box to Friendly URL as I did.|
|You will not find friendly_url_prefix and friendly_url_suffix among the settings in the image below - these have been deprecated in favor of extensions defined by Content Types and container_suffix (for Container Resources with Content Types having a mime_type of text/html).
The default Container Suffix setting is now "/" which results in the urls of container resources instead of the content type of the container. If you want your container resources to show as their content type, remove the "/" from this setting. If you have issues with packages that utilize the container suffix for FURLS (such as Articles), return this setting to "/".
|The use_alias_path setting allows the site to display directory structures. There are scenarios where all of the documents on the site might appear as directly off of the root, disregarding the paths. In this scenario you can simply choose not to have the paths utilized when Revolution presents the page.|
|The friendly_alias_urls setting was removed in MODX 2.1+. Enabling friendly_urls implies you are using friendly_alias_urls in 2.1+ and this setting was no longer useful or necessary.|
Make sure you have the following between the <head></head> tags:
And you're done!
|The easiest way to take advantage of using fully qualified Friendly URLs, is to allow MODx Revolution to build the links even within page content. As described at the bottom of resource tag syntax to create links to different resources, is easy as <a href="[[~1]]" title="some title">Some Page</a> . This has the added benefit of being able to move resources around a web project, without needing to fix a bunch of broken links, as MODx Revolution will simply update links created in this manner automatically.|