How to get WP-SuperCache Working

This is a step by step how-to to get wp-supercache enabled.

This is my source: http://www.lavluda.com/2007/07/15/how-to-enable-mod_rewrite-in-apache22-debian/

  1. First you need to get apache1.3 of higher installed. I have apache2. Type this command in Ubuntu:
    sudo apt-get install apache2
  2. Now that you have apache2 put this command in the terminal:
    updatedb
    locate mod_rewrite.so
  3. This will update the database and find the Rewrite Module for apache.
  4. Now that you have located mod_rewrite.so, you have to go and do a couple of things with some files.
  5. Go to this folder with the command that follows:
    cd /etc/apache2/mods-enabled
  6. The next step is to use this command:
    touch rewrite.load
  7. Using this last command will put this piece of code into rewrite.load:
    LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
  8. Now edit /etc/apache2/sites-available/default you can do this with either of these commands:
    sudo nano /etc/apache2/sites-available/default or
    sudo gedit /etc/apache2/sites-available/default
  9. Now that you have the file open, change:
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
  10. Change that to:
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
    Order allow,deny
    allow from all
  11. Now that you are finished with enabling mod_rewrite, we have to work with your .htaccess file.
  12. go to your sites root directory:
    cd /home/yoursiteroot/
  13. Edit your .htaccess with either of these commands:
    sudo nano .htaccess
    sudo gedit .htaccess
  14. copy and paste this into the .htaccess file:
    # BEGIN WPSuperCache
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    AddDefaultCharset UTF-8
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{QUERY_STRING} !.*=.*
    RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress|wp-postpass_).*$
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.$
    RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz [L]

    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{QUERY_STRING} !.*=.*
    RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress|wp-postpass_).*$
    RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.$
    RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html [L]
    </IfModule>
    # END WPSuperCache

    # BEGIN WordPress
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    # END WordPress

  15. save your work.
  16. And for the final thing to do is this command:
    sudo /etc/init.d/apache2 restart

Thanks for reading,
Ryan Orser


The Ubuntu Counter Project - user number # 26323

Leave a Reply