We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 39583
    • 103 Posts
    I have friendly urls setup in my modx installation which are working.
    But any sub-page to my forum isn't working. If I use forums/?action=user&user=1 I can for instance see my user. But all the links in the forum are friendly urls and are pointing to nowhere, I just end back up on the start page.

    This is my .htaccess in the modx folder. Is it anything here? Or could it be that I miss something in the system settings for discuss to make friendly urls working?
    RewriteEngine On
    RewriteBase /dir/dir/pages/
    RewriteCond %{HTTP_HOST} .
    
    # The Friendly URLs part
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NS]
     
    # Discuss rewrite rules
    RewriteRule ^forums/thread/([0-9]+)/(.*)$ forums/?action=thread&thread=$1 [L,QSA,NS]
    RewriteRule ^forums/u/(.+)$ forums/?action=user&user=$1 [L,QSA,NS]
    RewriteRule ^forums/board/([0-9]+)/(.*)$ forums/?action=board&board=$1 [L,QSA,NS]
    RewriteRule ^forums/category/([0-9]+)/(.*)$ forums/?category=$1 [L,QSA,NS]
    RewriteRule ^forums/(.+)$ forums/?action=$1 [L,QSA,NS]
    RewriteRule ^forums/(.+)/$ forums/?action=$1 [L,QSA,NS]
    
    BrowserMatch "MSIE" brokenvary=1
    BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1
    BrowserMatch "Opera" !brokenvary
    SetEnvIf brokenvary 1 force-no-vary
    
    AddType text/x-component .htc
    
      --
      André
      • 39583
      • 103 Posts
      Ok, just found the problem myself. But if anyone else has this problem put the rewriting for discuss before any other rewrite rule you might have, like this:

      RewriteEngine On
      RewriteBase /dir/dir/pages/
      RewriteCond %{HTTP_HOST} .
       
      # Discuss rewrite rules
      RewriteRule ^forums/thread/([0-9]+)/(.*)$ forums/?action=thread&thread=$1 [L,QSA,NS]
      RewriteRule ^forums/u/(.+)$ forums/?action=user&user=$1 [L,QSA,NS]
      RewriteRule ^forums/board/([0-9]+)/(.*)$ forums/?action=board&board=$1 [L,QSA,NS]
      RewriteRule ^forums/category/([0-9]+)/(.*)$ forums/?category=$1 [L,QSA,NS]
      RewriteRule ^forums/(.+)$ forums/?action=$1 [L,QSA,NS]
      RewriteRule ^forums/(.+)/$ forums/?action=$1 [L,QSA,NS]
      
      # The Friendly URLs part
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NS]
      
      BrowserMatch "MSIE" brokenvary=1
      BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1
      BrowserMatch "Opera" !brokenvary
      SetEnvIf brokenvary 1 force-no-vary
      
      AddType text/x-component .htc
      
      
        --
        André