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

    I’m sorry, I can’t see what I do wrong.
    I enter this in my terminal for activate the url rewriting module:
    $ sudo a2enmod rewrite
    This module is already enabled!
    Restart Apache : Ok.
    Go in manager and activate these options:
    Use friendly URLs: Y
    Prefix for friendly URLs:
    Suffix for friendly URLs: .html
    Use friendly aliases: Y
    Use friendly alias path: Y
    Allow duplicate aliases: N
    Automatically generate alias: N
    Save: Ok.
    Let’s rename de ht.access in .htaccess in the sub-directory /var/www/modx921/ where I have install MODx : OK.
    Edit the .htaccess:
    # php_flag zlib.output_compression On
    # php_value zlib.output_compression_level 5
    
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    
    RewriteRule ^(.*)$ /modx921/index.php?q=$1 [L,QSA]
    


    In the virtualhost I had define for /var/www/modx921 to http://modx921.com/ : Ok.
    http://modx921.com/contact-us.html : Internal Server Error. The same for all the url rewrited.

    Could you help me please?
      • 22303 MODX Staff
      • 10,725 Posts
      Make sure Apache has the proper permissions to "allow overrides" in your virtual directory configuration, otherwise, it will not be able to handle the .htaccess directives.
        • 3763
        • 155 Posts
        Shouldn’t it just return a 404/Not Found if mod_rewrite is installed but AllowOverride is not active? I always had the 404 error in this case on several servers.

        AFAIK, the server returns a 500/Internal Server Error when something is not correct in the .htaccess file or a command is not supported.

        @tupolev
        You need this in your httpd.conf file:
        <Directory "/var/www/modx921">
           AllowOverride All
        
           Order allow,deny
           Allow from all
        </Directory>


        Later Edit: You can use the apache-get-modules PHP function for an additional modules test.

        Boby
          ...my Photo Gallery on Flickr...
          • 30807
          • 25 Posts
          @Boby : hello
          In my /etc/apache2/sites-available/ I have create a modx921.conf and activate with a a2ensite modx921.conf
          Then: /etc/init.d/apache2 reload

          Here is my modx921.conf
          <VirtualHost 192.168.0.2:8080>
          	ServerAdmin webmaster@localhost
          
              	DocumentRoot    /var/www/modx921
              	ServerName    modx921.com
          <Directory "/var/www/modx921">
          		Options FollowSymLinks
          		AllowOverride All
          
          		Order allow,deny
          		Allow from all
          </Directory>
          	ErrorLog /var/log/apache2/error.log
          </VirtualHost>


          error.log for Apache:
          [error] [client 192.168.0.2] mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary., referer: http://modx921.com/


          And now I must see where please? Sorry.
            • 3763
            • 155 Posts
            Maybe the default maxredirects value was set zero or one.

            You can try following in your .htaccess file:
            RewriteEngine On
            RewriteOptions maxredirect=10
            
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule ^(.*)$ /modx921/index.php?q=$1 [L,QSA]


            If you still have the error, increase the value of:
            RewriteOptions maxredirect=10


            http://www.sitepoint.com/print/mod_rewrite-no-endless-loops

            I also think you need to remove the modx921 folder of your rewrite rule because this is your DocumentRoot and not a subfolder of it (maybe I am wrong)
            RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]


            Boby
              ...my Photo Gallery on Flickr...
              • 30807
              • 25 Posts
              @Boby: wow!! Houra, you have true!

              In my .htaccess I only changed this line:
              RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]


              Topic solved for me but I don’t modify the subjet if someone has any idea for your question, Boby. Or you repost in another?

              Thanks a lot and have a nice day all.