We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 50538
    • 8 Posts
    Hey. I am totaly new in ModX so m.b. my question is silly, but I can't solve it by myself even after active googling. SO, MODX Revolution 2.4.2.
    General settings are in attach. Briefly:

    • friendly_alias_strip_element_tags - Yes
    • friendly_urls - Yes
    • friendly_urls_strict - No
    • global_duplicate_uri_check - No
    • use_frozen_parent_uris - No
    Domain name - just http://bus:7777 (local server, Open Server, Apache 2.0+).
    .htaccess
    RewriteCond %{HTTP_HOST} .
    RewriteCond %{HTTP_HOST} !^bus:7777\ [NC]
    RewriteRule (.*) http://bus:7777/$1 [R=301,L]
    


    Full file in attach.

    http://bus:7777/contacts.html


    Object not found!

    The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

    If you think this is a server error, please contact the webmaster.
    Error 404
    bus
    02/03/16 13:57:03
    Apache/2.2.31 (Win32)

    After disabling friendly URL all works.
    Will be greatfull for any kind of help.

    This question has been answered by cove3010. See the first response.

      • 38783
      • 571 Posts
      Have you enabled rewrites by adding this to the .htaccess file, before the rewrite conditions in your example?

      RewriteEngine On
      RewriteBase /

        If I help you out on these forums I would be very grateful if you would consider rating me on Trustpilot: https://uk.trustpilot.com/review/andytough.com

        email: [email protected] | website: https://andytough.com
        • 50538
        • 8 Posts
        Quote from: andytough at Feb 03, 2016, 11:34 PM
        Have you enabled rewrites by adding this to the .htaccess file, before the rewrite conditions in your example?

        RewriteEngine On
        RewriteBase /

        Unfortunately yes, first block in attached file:

        # MODX supports Friendly URLs via this .htaccess file. You must serve web
        # pages via Apache with mod_rewrite to use this functionality, and you must
        # change the file name from ht.access to .htaccess.
        #
        # Make sure RewriteBase points to the directory where you installed MODX.
        # E.g., "/modx" if your installation is in a "modx" subdirectory.
        #
        # You may choose to make your URLs non-case-sensitive by adding a NC directive
        # to your rule: RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NC]
        
        RewriteEngine On
        RewriteBase /
        

          • 3749
          • 24,544 Posts
          The FURLs part of .htaccess looks like this:

          RewriteCond %{REQUEST_FILENAME} !-f
          RewriteCond %{REQUEST_FILENAME} !-d
          RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]


          Also, make sure your have this tag in the head section of all templates:

          <base href="[[++site_url]]" />
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 47212
            • 40 Posts
            There is also some requirements on your server to check in order to use URL rewriting.

            First, you can verify if apache mod_rewrite module is enabled with the following command in the terminal :
            ls /etc/apache2/mods-enabled | grep rewrite

            You have to replace "/etc/apache2/" by the path where apache is installed on your machine. If you are on a local environment provided by a software like MAMP, XAMP or WAMP, you have to look into the program files of the software.

            If it does, this will return you :
            rewrite.load


            If it is not enabled, you can active mod_rewrite module with this command :
            a2enmod rewrite


            Then you have to check your "etc/apache2/sites-available/myConfFile.conf" config file and verify that there is an "AllowOverride" option :
            <Directory "project/path">
              Order allow,deny
              Allow from all
              AllowOverride All
            </Directory>

            (Replace "project/path" by the path of your site, you have to indicate the full path starting at the very top root of your machine, this is not a relative path).


            Then restart apache to make this changes happened :
            service apache2 restart


            I tested this on a Linux debian, this solved my friendly url problem. [ed. note: romainfallet last edited this post 8 years, 2 months ago.]
              • 3749
              • 24,544 Posts
              FYI -- If you're using XAMPP on a localhost install, the rewrite engine is off by default. You have to uncomment the line that turns it on in the XAMPP/apache/conf/httpd.conf file. Remove the # in front of this line:

              LoadModule rewrite_module modules/mod_rewrite.so
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
              • discuss.answer
                • 50538
                • 8 Posts
                Problem solved by renaming .htaccess, which is named by default incorrectly.