That’s Arguable

January 18, 2009

Dee’s blog fixed!

Filed under: Site — Tags: , , — jnargus @ 15:12

I finally got all the details worked out to get permalinks working properly. Nobody ever tells you all that you need to do to get something working. WordPress just says put these lines in your .htaccess file. They fail to mention that you need to load and enable the mod_rewrite module and that the apache2/sites-available/default file needs to be modified so that the .htaccess file will be looked at. All of which I found out with a little bit of help from Brenda. So to summarize This is what needs to be done to get permalinks working properly:

  • Load and Enable the mod_rewrite module. This is done by running:
    $sudo a2enmod
    Which module would you like to enable?
    Your choices are: actions alias asis auth_anon auth_basic auth_dbm auth_digest auth_ldap authn_alias authn_anon authn_dbd authn_dbm authn_default authn_file authnz_ldap authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cern_meta cgid cgi charset_lite dav_fs dav dav_lock dbd deflate dir disk_cache dump_io env expires ext_filter file_cache filter headers ident imagemap imap include info ldap log_forensic mem_cache mime mime_magic negotiation php5 proxy_ajp proxy_balancer proxy_connect proxy_ftp proxy_http proxy rewrite setenvif speling ssl status substitute suexec unique_id userdir usertrack version vhost_alias
    Module name? rewrite
    Module rewrite installed; run /etc/init.d/apache2 force-reload to enable.
    This is not the way I did it at first but it is the better way. all this process does is to create a symbolic link to /etc/apache2/mods-available/rewrite.load in /etc/apache2/mods-enabled/. This can be done with the ln -s command as well but some modules have a .conf file as well and a link to that module will need to be created as well. The a2enmod tool does everything for you.
  • Enable the .htaccess file
    This is the start of the /etc/apache2/sites-available/default file. I changed the two bold lines to get the permalinks working. The first one didn’t seem to work on it’s own but when I changed the second one it worked. I haven’t yet tried to put the first line back the way it was but I don’t think I will unless I have to. Both lines originally read “AllowOverride None
    NameVirtualHost *
    <VirtualHost *>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/arguable/
    <Directory />
    Options FollowSymLinks
    AllowOverride FileInfo
    </Directory>
    <Directory “/var/www/arguable”>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride FileInfo
    Order allow,deny
    allow from all
    # This directive allows us to have apache2′s default start page
    # in /apache2-default/, but still have / go to the right place
    #RedirectMatch ^/$ /apache2-default/
    </Directory>
  • Restart Apache
    The following command will restart Apache:
    sudo /etc/init.d/apache2 restart
  • Edit the .htaccess file
    Using your favorite editor put the following lines in the .htaccess file located at the root of the web server.<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /dee/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /dee/index.php [L]
    </IfModule>

    Changes to this file happen immediately so no reboots or restarts of anything are needed.

So unless I forgot something this is what it took to get the pretty permalinks working for Dee’s blog.

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress