We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20004
    • 4 Posts
    Intro
    - This is a note to fellow newbies who’ve experienced the same issue.
    - I believe I’ve solved my problem (see also ’Final Notes’) but I’ve posted as it may help others.
    - Tags: friendly URLS, .htaccess, httpd.conf, 404 error, Windows XP

    Quick Scenario
    - Friendly URLs doesn’t work. I’ve followed every step but still get 404 error.

    Quick Solution
    - Ensure you’ve changed "AllowOverride None" to "AllowOverride All" in EVERY instance in your Apache httpd.conf file.
    - Why 404 error? Because Apache is more than likely NOT parsing your MODx .htaccess file.

    Hope this helps.


    In-depth (for those interested)...

    Scenario
    - I’ve enabled Friendly URLs in MODx settings (via management console), and I’ve changed "AllowOverride None" to "AllowOverride all" between the <Directory /> and </Directory> markers in the Apache httpd.conf file, and I’ve followed the instructions (e.g. http://wiki.modxcms.com/index.php/Friendly_URLs_Guide) to modify my .htaccess file for re-writing conditions.
    - I’ve done all these things, but I still receive a 404 Error when navigating to http://localhost:8080/testingmodx/modx-2.0.4-pl2/testingalias.
    - Note: your URL will of course be different: you may using 127.0.0.1 instead of localhost, your port may be the default 80, and your MODx install path may be c:\apache-X.Y.Z\htdocs\modx.

    What to do?
    1. Try typing random nonsense in your .htaccess file, e.g. "aaoijfafwe452452", and testing that Apache is parsing your .htaccess file:
    1.1 Done, now I get an "Internal Server Error".
    1.1.1 Ok, Apache IS parsing your .htaccess file but your RewriteCond statements must not be functioning correctly. Did you follow the instructions correctly? Go back and make sure you do, then try again.

    1.2 Done, but I still get the 404 error.
    1.2.1 Ok, Apache is NOT parsing your .htaccess file. Open your Apache httpd.conf file again and search for "AllowOverride None". Yes yes, you have already changed it once, but did you change BOTH instances? Change the second one also to "AllowOverride all". 1.2.2 Now go back to "What to do" 1. and try the random nonsense to ensure parsing.
    1.2.3 Or, skip 1.2.2, remove any nonsense from your .htaccess file, save it, and try your Friendly URL once again.
    1.2.4 You should now see your page correctly

    Final Notes
    - The instructions I followed (see http://wiki.modxcms.com/index.php/Friendly_URLs_Guide) did mention the other instances of "AllowOverride None" but it did not explicitly advise to change each one, hence I originally changed ONLY the primary instance (between <Directory... etc.).
    - Perhaps more knowledgeable members can comment on whether this solution is best practice, or whether it just happens to work and creates other issue(s).
    - Please remember to restart Apache if you change the httpd.conf file.

    P.s.
    - Windows XP SP3
    - Apache 2.2
    - PHP 5.3.3
    - MODx Revolution 2.0.4
    - Developed on localhost / 127.0.0.1


    Regards
      • 31662
      • 10 Posts
      This helped me to make fURLs work! Thanks.
      After the 500 error condition finally happens, allow me a quick note from my experience, developing in a localhost/site folder structure:

      RewriteEngine On
      RewriteBase /site
      
      # Rewrite www.domain.com -> domain.com -- used with SEO Strict URLs plugin
      #RewriteCond %{HTTP_HOST} .
      #RewriteCond %{HTTP_HOST} !^example-domain-please-change\.com [NC]
      #RewriteRule (.*) http://example-domain-please-change.com/$1 [R=301,L]
      #
      # or for the opposite domain.com -> www.domain.com use the following
      # DO NOT USE BOTH
      #
      #RewriteCond %{HTTP_HOST} .
      #RewriteCond %{HTTP_HOST} !^www\.example-domain-please-change\.com [NC]
      #RewriteRule (.*) http://www.example-domain-please-change.com/$1 [R=301,L]
      
      # The Friendly URLs part
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ /site/index.php?q=$1 [L,QSA,NC]
      


      Note that both the url conditions are commented out, RewriteBase is set to see the folder but also RewriteRule has the folder set. This bugged me a little, but forums helped, as always.

      Thanks