WordPress permalink on CentOS 5 tutorial

Posted: June 14, 2011 by Hacking & Relax in Linux, Wordpress

The installation of WordPress is simple and straightforward. Really. So I’m not going to detail the installation process, which is well documented here. However, the permalink feature does not work out of the box on a standard CentOs 5 distribution. Some changes have to be made in the apache configuration files to enable mod_rewrite in your WordPress directory.

Let’s say you installed WordPress in the root of your website. By default on your CentOs’s apache, the document root of your website is located in /var/www/html.

    1. create an empty a .htaccess file in this directory.
    2. WordPress should be able to read/write this file when updating your settings in the admin pages, so make sure the user running apache has the right to write this file. If not, chmod/chown it. Usually this should do the trick:
      chown apache:apache /var/www/html/.htaccess
    3. now edit the /etc/httpd/conf/httpd.conf file. Search the following:
<Directory "/var/www/html">

# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
    AllowOverride None
  1. Change this line to:
    AllowOverride All

    This allows apache to read and interpret the .htaccess located in you document root.

  2. Restart Apache
  3. Now you can change your permalink settings in the admin pages of WordPress, which will modify the .htaccess file created above.Check the rights of the .htaccess file, maybe apache can write it but not read it.
  4. If so, try :chmod a+r /var/www/html/.htaccess

2. Config permalink for VirtualHost:

<VirtualHost *:80>
     ServerAdmin webmaster@host.foo.com
     DocumentRoot /www/docs/host.foo.com
     ServerName host.foo.com
     ErrorLog logs/host.foo.com-error_log
     CustomLog logs/host.foo.com-access_log
     <Directory /www/docs/host.foo.com/>
           Options FollowSymLinks
     </Directory>
</VirtualHost>
Advertisements
Comments
  1. Me-Chat says:

    Nice for Posting….
    I;m searching…n meet your post

    i like this

    visit Me–..:D

    Im Newbie….:D

    thanks…:D

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s