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/
- First you need to get apache1.3 of higher installed. I have apache2. Type this command in Ubuntu:
sudo apt-get install apache2 - Now that you have apache2 put this command in the terminal:
updatedb
locate mod_rewrite.so - This will update the database and find the Rewrite Module for apache.
- Now that you have located mod_rewrite.so, you have to go and do a couple of things with some files.
- Go to this folder with the command that follows:
cd /etc/apache2/mods-enabled
- The next step is to use this command:
touch rewrite.load
- Using this last command will put this piece of code into rewrite.load:
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
- 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 - Now that you have the file open, change:
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all - Change that to:
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all - Now that you are finished with enabling mod_rewrite, we have to work with your .htaccess file.
- go to your sites root directory:
cd /home/yoursiteroot/ - Edit your .htaccess with either of these commands:
sudo nano .htaccess
sudo gedit .htaccess - 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 - save your work.
- And for the final thing to do is this command:
sudo /etc/init.d/apache2 restart
Thanks for reading,
Ryan Orser