We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21136
    • 103 Posts
    Hello smiley

    I am new to MODx but already heavy into it!!!

    I need some assistance with mod_rewrite please. I have my own dedicated server with many domains that use mod_rewrite that have WordPress installs and all works great... No problems with mod_rewrite on any of these WordPress domains but...

    I cannot get mod_rewrite to work on the MODx install. I have even re-installed from scratch a few times and still the same results.

    I have tried varied combinations and still nothing. Can someone please assist me in this smiley

    Here are the contents of my .htaccess files...

    [MODx]
    ------------------------------------------

    Addhandler application/x-httpd-php .htm .html .php
    php_flag allow_url_fopen on

    php_flag zlib.output_compression On
    php_value zlib.output_compression_level 5

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


    [WordPress]
    ------------------------------------------

    Addhandler application/x-httpd-php .htm .html .php
    php_flag allow_url_fopen on
    IndexIgnore *
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    # END WordPress

    ------------------------------------------

    Sincerely,

    Ken Roberts
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      try commenting out the zlib lines. Those can cause trouble if your server configruation doesn’t allow it.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 21136
        • 103 Posts
        I did rem the zlib lines and still the same results sad

        thanks.

        Ken
          • 6726
          • 7,075 Posts
          Funny... I never had problems with rewrite rules either on shared hosting or dedicated...
          Which Apache version ?

          Question : did you try it with MODx default .htaccess ?

          Not sure about this line

          php_flag allow_url_fopen on

          Plus, last I heard it’s not the safest directive to add to your .htaccess, and MODx, contrary to WordPress, doesn’t need it...

            .: COO - Commerce Guys - Community Driven Innovation :.


            MODx est l&#39;outil id
            • 21136
            • 103 Posts
            Yes - I used the default .htaccess too - just switched back again now

            same results sad

            currently Apache/1.3.29
              • 22303 MODX Staff
              • 10,725 Posts
              Nor is it necessary to set the PHP handler to process html/htm files. Usually not real good on the performance if you are serving any plain HTML along with your PHP site.

              You might also try adding the RewriteBase / line before the conditions and making the rule point at /index.php...

              Also, what is the response, or not working about it...?
                • 21136
                • 103 Posts
                Here is all I have in my .htaccess now with same results sad

                RewriteEngine On
                RewriteBase /
                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteCond %{REQUEST_FILENAME} !-d
                RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
                  • 22303 MODX Staff
                  • 10,725 Posts
                  What is the result?
                    • 21136
                    • 103 Posts
                    The results are that it didn’t work sad

                    Is there anything in MODx that I need to do or should mod_rewrite take care of creating friendly URL’s?

                    As example, in WordPress I have to modify the permalink structure before mod_rewrite works. Anything like that in MODx that I need to do?

                    Regards,

                    Ken
                      • 31337
                      • 258 Posts
                      when you say "don’t work", how does it not work? are there any errors or debug messages if you turn debug on?

                      Also, try doing this without your WP rewrite rules in place. It looks to me like they’re conflicting with your modx rewrite rules.