We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 46886
    • 1,154 Posts
    Ok I have started things up finally, still a long way to go.

    But one first issue was the htaccess, I guess the automatic rules didn't go through or something.

    Anyway, that's why the site was visible but you can't go into any forum or do anything. It was there, but didn't work.

    My awesome admin fixed it, here are our settings (comments mostly removed):

    RewriteEngine On
    RewriteBase /
    
    # Rewrite to HTTPS:
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    
    # Rewrite thewebsite.com -> www.thewebsite.com
    RewriteCond %{HTTP_HOST} .
    RewriteCond %{HTTP_HOST} !^www\.thewebsite\.com [NC]              
    RewriteRule (.*) http://www.thewebsite.com/$1 [R=301,L]     
    
    # Discuss rewrite rules
    RewriteRule ^forums/thread/([0-9]+)/(.*)$ forums/?action=thread&thread=$1 [L,QSA]
    RewriteRule ^forums/u/(.+)$ forums/?action=user&user=$1 [L,QSA]
    RewriteRule ^forums/board/([0-9]+)/(.*)$ forums/?action=board&board=$1 [L,QSA]
    RewriteRule ^forums/category/([0-9]+)/(.*)$ forums/?category=$1 [L,QSA]
    RewriteRule ^forums/(.+)$ forums/?action=$1 [L,QSA]
    RewriteRule ^forums/(.+)/$ forums/?action=$1 [L,QSA]
    
    # The Friendly URLs part
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]


    Nice code huh? Comments rock.

    Now on to css, fun stuff like the registration page, and webpage styles ;-)
    • It's a little interesting that you enable HTTPS, but then you rewrite without HTTPS.

      I would think you want the following, or did I miss something?

      RewriteEngine On
      RewriteBase /
       
      # Rewrite to HTTPS:
      RewriteCond %{HTTPS} off
      RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
       
      # Rewrite thewebsite.com -> www.thewebsite.com
      RewriteCond %{HTTP_HOST} .
      RewriteCond %{HTTP_HOST} !^www\.thewebsite\.com [NC]              
      RewriteRule (.*) https://www.thewebsite.com/$1 [R=301,L]     
       
      # Discuss rewrite rules
      RewriteRule ^forums/thread/([0-9]+)/(.*)$ forums/?action=thread&thread=$1 [L,QSA]
      RewriteRule ^forums/u/(.+)$ forums/?action=user&user=$1 [L,QSA]
      RewriteRule ^forums/board/([0-9]+)/(.*)$ forums/?action=board&board=$1 [L,QSA]
      RewriteRule ^forums/category/([0-9]+)/(.*)$ forums/?category=$1 [L,QSA]
      RewriteRule ^forums/(.+)$ forums/?action=$1 [L,QSA]
      RewriteRule ^forums/(.+)/$ forums/?action=$1 [L,QSA]
       
      # The Friendly URLs part
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NC]
      


      In either case thanks for taking the time to share!
        Patrick | Server Wrangler
        About Me: Website | TweetsMODX Hosting
        • 46886
        • 1,154 Posts
        Heh ooops! Fixed!

        You are the server man without a doubt...
        • Occupational hazzard laugh

          If you want to take things further you might try adding this to the end of your .htaccess file. It should help speed things up some, assuming your server supports deflate.

          <ifmodule mod_deflate.c>
          AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript
          </ifmodule>
          
          <IfModule mod_expires.c>
              ExpiresActive On
              ExpiresDefault "access plus 10 days"
              ExpiresByType text/css "access plus 1 week"
              ExpiresByType text/plain "access plus 1 month"
              ExpiresByType image/gif "access plus 1 month"
              ExpiresByType image/png "access plus 1 month"
              ExpiresByType image/jpeg "access plus 1 month"
              ExpiresByType application/x-javascript "access plus 1 month"
              ExpiresByType application/javascript "access plus 1 week"
              ExpiresByType application/x-icon "access plus 1 year"
          </IfModule>
          


          GZIP Details: http://salscode.com/tutorials/2009/10/15/gzip-htaccess/
          Expires: http://css-tricks.com/snippets/htaccess/set-expires/

          The first bit of code reduces the file size of text based content. You could add images, but I wouldn't recommended it. The second bit tells the browser to cache the files saving additional bandwidth and reduce server requests. You might want to leave the second half off during development.

          This is just scratching the surface of performance tweaks, you can do some really awesome stuff leveraging services like CloudFlare and www.jsdelivr.com.
            Patrick | Server Wrangler
            About Me: Website | TweetsMODX Hosting
            • 46886
            • 1,154 Posts
            Wow that is great thank you! More efficient systems are what we are about!!

            Now on to styling ;-(

            Quote from: AMDbuilder at Mar 31, 2014, 09:36 PM
            Occupational hazzard laugh

            If you want to take things further you might try adding this to the end of your .htaccess file. It should help speed things up some, assuming your server supports deflate.

            <ifmodule mod_deflate.c="">
            AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript
            </ifmodule>
            
            <ifmodule mod_expires.c="">
                ExpiresActive On
                ExpiresDefault "access plus 10 days"
                ExpiresByType text/css "access plus 1 week"
                ExpiresByType text/plain "access plus 1 month"
                ExpiresByType image/gif "access plus 1 month"
                ExpiresByType image/png "access plus 1 month"
                ExpiresByType image/jpeg "access plus 1 month"
                ExpiresByType application/x-javascript "access plus 1 month"
                ExpiresByType application/javascript "access plus 1 week"
                ExpiresByType application/x-icon "access plus 1 year"
            </ifmodule>
            


            GZIP Details: http://salscode.com/tutorials/2009/10/15/gzip-htaccess/
            Expires: http://css-tricks.com/snippets/htaccess/set-expires/

            The first bit of code reduces the file size of text based content. You could add images, but I wouldn't recommended it. The second bit tells the browser to cache the files saving additional bandwidth and reduce server requests. You might want to leave the second half off during development.

            This is just scratching the surface of performance tweaks, you can do some really awesome stuff leveraging services like CloudFlare and www.jsdelivr.com.