We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32699 ☆ A M B ☆
    • 427 Posts
    As this topic has been updated with the updates of Revolution, please refer to the official docs for current information: http://rtfm.modx.com/display/revolution20/Using+Friendly+URLs








    Friendly URLS require two things: a working .htaccess file (not ht.access) in the root of your site (can be anywhere above or at the top of the site)
    /htdocs is fine or /public_html or what ever. It just has to be at or above the documents it affects. Be aware some control panels like to write their own just above the site level so the best place to put it is where the home page of ModX is (the index.php which drives the entire site): typically /www

    My .htaccess (with additional comments removed)
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} .
    RewriteCond %{HTTP_HOST} !^www\.DOMAINNAME\.TLD [NC]
    RewriteRule (.*) http://www.DOMAINANME.TLD/$1 [R=301,L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
    [i]ExpiresActive On
    ExpiresByType image/gif A2592000
    ExpiresByType image/jpeg A2592000
    ExpiresByType image/png A2592000
    BrowserMatch "MSIE" brokenvary=1
    BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1
    BrowserMatch "Opera" !brokenvary
    SetEnvIf brokenvary 1 force-no-vary[/i]
    


    change the DOMAIN to your domain name in lowercase.
    For me: shawnwilkerson

    change the TLD to the com, net, org, info, whatever you have
    For me: com

    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. Italicized content left to show entire file, but is not necessary for Friendly URLS.

    Next change the settings on Page Two, Section 7 of the System Settings in the System menu of the Revolution Manager to something like the following image indicates.

    Finally clear the ModX Revolution cache.

    I personally had issues with link directly to my resume.pdf file so I turned off: automatically create alias. More than likely it was something I was not doing correctly, as my resume was the first thing I did after turning on Friendly URLS and even before building the first page or templates.



      Get your copy of MODX Revolution Building the Web Your Way http://www.sanitypress.com/books/modx-revolution-building-the-web-your-way.html

      Check out my MODX || xPDO resources here: http://www.shawnwilkerson.com
      • 28215
      • 4,149 Posts
      wshawn, would you like to put these things in the official docs?

      PM me and I can get you access.
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 27330
        • 884 Posts
        my beta-5 don’t have suffix for friendly url option in the site config.
        I see that it defaults to html even if I set page.php . Anyway to overwrite it?
          • 22303 MODX Staff
          • 10,725 Posts
          Quote from: sinbad at Dec 20, 2009, 10:11 PM

          my beta-5 don’t have suffix for friendly url option in the site config.
          I see that it defaults to html even if I set page.php . Anyway to overwrite it?
          Revolution friendly urls do not have suffixes. They have extensions defined by Content Type. You can edit this from Content Types in the System menu.
            • 32699 ☆ A M B ☆
            • 427 Posts
            It is better to not have any suffixes.

            As, it provides you a layer of "protection" from people trying to hack ASP and the PHP because they simply see html and move on.

            The less you announce about your setup -- the better you are -- to a point. A dedicated hacker, will usually go after your OS first, then the hosting software, and then switch to application breaches.

            The longer they have to work the less likely they will. But be assured -- they is no such thing as a secure computer. Even security updates have been known to introduce a guy with flashlights jumping out of a hackers monitor, who then begins signaling the hacker in for a landing.


              Get your copy of MODX Revolution Building the Web Your Way http://www.sanitypress.com/books/modx-revolution-building-the-web-your-way.html

              Check out my MODX || xPDO resources here: http://www.shawnwilkerson.com
              • 27330
              • 884 Posts
              well i am trying to get no extension at all. the only way to as i see is if i set the document to container.
              love the content type option, when I added php as content type and selected it I got the .php extension fine.
              only fills wrong to set the doc to container but I don’t see a real problem with it.
                • 32699 ☆ A M B ☆
                • 427 Posts
                I am using no extension at all:

                suffix left blank
                prefix left blank
                container /

                Even in this configuration the last layer of documents in a path will still have .html placed on it.

                As was noted, a new content type would need to be created to get the php extension allowed. Technically speaking, a php page is not a php page any more once it hits a browser -- it would be html, so I understand why that context would apply by default.
                  Get your copy of MODX Revolution Building the Web Your Way http://www.sanitypress.com/books/modx-revolution-building-the-web-your-way.html

                  Check out my MODX || xPDO resources here: http://www.shawnwilkerson.com
                  • 22303 MODX Staff
                  • 10,725 Posts
                  Quote from: wshawn at Dec 22, 2009, 05:29 AM

                  I am using no extension at all:

                  suffix left blank
                  prefix left blank
                  container /

                  Even in this configuration the last layer of documents in a path will still have .html placed on it.

                  As was noted, a new content type would need to be created to get the php extension allowed. Technically speaking, a php page is not a php page any more once it hits a browser -- it would be html, so I understand why that context would apply by default.
                  Suffix and prefix no longer apply in Revo at all. The extension applied to the HTML Content Type is responsible for the .html being added; but you can remove it so there are no extensions added to your pages at all. You could also create multiple text/html Content Types if you wanted to have some Resources have .php and others .html. This is completely customizable.
                    • 32699 ☆ A M B ☆
                    • 427 Posts
                    Should those options be removed from the Settings then?
                      Get your copy of MODX Revolution Building the Web Your Way http://www.sanitypress.com/books/modx-revolution-building-the-web-your-way.html

                      Check out my MODX || xPDO resources here: http://www.shawnwilkerson.com
                      • 22303 MODX Staff
                      • 10,725 Posts
                      Quote from: wshawn at Dec 22, 2009, 12:31 PM

                      Should those options be removed from the Settings then?
                      They were for beta-5; they were originally kept because they may be used in Evo to Revo upgrade scripts, but we decided the confusion was not worth it and we can find a way to use them if they do exist anyway. Feel free to remove them.