Home » Blog » .htaccess and WordPress

.htaccess and WordPress


by Paul Flyer

Everyone at some time or another has had an issue with .htaccess and their WordPress installation. This typically has implications for the use of Permalinks, but it impacts other things as well.

This post is an attempt to make some things clear for users.

What are permalinks?

Permalinks are the URL’s created for each individual post. Typically, an application like WordPress creates that link this way: http://www.yoursite.com/?p=54 or something to that affect. It is not very pretty nor search engine friendly. Changing the permalink structure can create both pretty and search engine friendly links. For example: http://www.yoursite.com/mycategory/this-is-what-i-think

For more info see Using Permalinks on the WordPress Codex site.

Before employing pretty permalinks there are several questions to ask.

What version of Apache is the web host using? Apache is the web server used by many web host providers to “get” your web site onto the Internet. Typically this could be found in the administrative panel provided by your web host. A lot of providers use cPanel as the administrative tool. On mine, there is an Info Button. The Info page has a Versions and Paths link. Clicking that link displays the various services used by my web host and the version of each service. In my case, Apache’s version is 1.3.33. The navigation to this information may be different then what I described. If you need help, leave a comment or email me.

If Apache is anything less than version 2.0 OR you host does not use Apache, then you only have one choice for permalinks.: /index.php/ needs to be included as part of the permalink structure.

Example:
www.yoursite.com/index.php/this-is-what-i-think.

See the Options/Permalinks menu within Wordpress for more info on setting this up. Though this method is considered a “hack”, it avoids having to deal with the .htaccess file.

If Apache is 2.0 or above, then you must determine whether the host has an Apache module called mod_rewrite installed on your server.

How do I find out if mod_rewrite is on my server?

Sometimes the administrative panel will have a button to access PHP info. If not, temporarily create a page named “test.php”. Add one line to this file:

php_info();

Upload the file to your website. Access the file through your browser: http://www.yoursite.com/test.php

The screen should display a white background with purple headings detailing the PHP installation. Look for the category labeled Apache. Under this category there should be a row labeled “Loaded Modules”. In the cell next to this label look to see if the mod_rewrite is listed. If it is, then it is installed.

If you have Apache 2.0 or higher and mod_rewrite is installed then you can use the method described below for the permalink structure, else you will have to use the solution above that uses /index.php/.

This method updated the .htaccess file. Starting with WordPress 1.5, WordPress automaticaly updates this file.

I have included two helpful posts from the WordPress support site that simplify the steps:

————————————————————————————————-
From viitoria:

Here’s what I did when I got just about every single problem posted on this page.

1) Make a .htaccess file, but leave it blank.
2) Upload it into the directory your WP index.php page is.
3) Change chmod of the .htaccess to 777
4) Update permalinks
5) Change chmod of .htaccess back to 644 (for your own protection)

It should work now. Hope this helps.
————————————————————————————————-

————————————————————————————————-
From Tim

I’ve struggled with this for a couple of days and finally got it to work using exactly the same steps as the poster above but with the addition of one step:

4b) edit the .htaccess file generated by wordpress and add the line Options +Followsymlinks so that the first three lines of this file now read:

<IfModule mod_rewrite.c>
Options +Followsymlinks
RewriteEngine On

(There’s no point adding this line before WP updates the .htaccess file: you addition will just be overwritten.)

This is assuming of course that Apache is configured to allow .htaccess files. You need AllowOverride to be set to All in your /etc/apache2/httpd.conf and .htaccess to be defined as the name of the file that can override the default settings. The section should look something like this:

<Directory />
Options None
AllowOverride All
Order deny,allow
Deny from all
</Directory>

# use .htaccess files for overriding,
AccessFileName .htaccess

Hope this helps someone

Tim
————————————————————————————————-

I should add that further instructions for implementing step 4 can be found at the Options/Permalinks menu within Wordpress. There are many suggestions and opinions about the exact structure for permalinks. At the very least, include the post name. Another recommendation can be found here.

05.25.2005 @ 10:15 AM — Filed under: Add to del.icio.us | Add to diigo

TrackBack this entry

Comments »

  1. gyrmination » Blog Archive » WordPress Wonder comments:

    [...] .htaccess and WordPress [...]

    August 2nd, 2005 at 2:36 am


  2. » htaccess Tutorial for beginners :: Recommended Web Tools comments:

    [...] One of the most popular pages on this site is a post I wrote about htaccess and Wordpress. [...]

    August 25th, 2006 at 3:23 pm


  3. Michi comments:

    Thanks for the helpful post!
    Finally, I could solve my problem.

    September 22nd, 2006 at 9:13 am


  4. WordPress, PermaLink, .htaccess and 500 Internal Server Error | HUMVOX comments:

    [...] I got the reason behind my error and the solution I needed. A big thanks and cyber hug to this post and to viitoria for the [...]

    June 6th, 2007 at 11:32 pm


  5. Anita comments:

    I have an Windows based server and are using IIS 6 instead of Apache. Do you have any idea of what i should do to change my permalinks. I get an error when i change the default permalink.

    July 16th, 2007 at 5:58 am


  6. Alessandra comments:

    Very good tutorial! The only one that solved my problem! :) Thanks

    September 14th, 2007 at 11:16 am


  7. Paul Flyer comments:

    You’re welcome Alessandra!

    September 26th, 2007 at 5:52 pm


Leave a comment

Note: All comments are moderated. It may take 24-72 hrs for your comment to appear.

Partners

Point of Sale POS Software
The source for pos software point of sale & pos systems.



Ebook Feature

Domain Name Handbook

The Domain Name Handbook

Content Links

Recent Blog Posts

Blog Categories

Content You Should Read

  1. The Domain Name Handbook
  2. Keyword Analysis
  3. Search Engine Optimization Tip
  4. Diigo Social Bookmarking
  5. Website Validation
  6. 10 Things Text Link Brokers Can Improve
  7. 10 Text Link Advertising Pitfalls
  8. Three Problems with Google Analytics
  9. Merchant Account Comparison

Most Viewed Content

  1. Web Development and Design
  2. Web Tools
  3. Digital Point Keyword Suggestion Tool
  4. Removing Line Breaks After H1 Tags
  5. Google Analytics Review Part 1
  6. Keyword Suggestion Tools
  7. Three Problems with Google Analytics
  8. Graphic Design Tools
  9. Keyword Popularity Research
  10. Web Tools Directory

Most Clicked Links

  1. Digital Point Keyword Suggestion Tool
  2. Absolute Color Picker
  3. How to Build Websites
  4. HTML Kit
  5. HTMLDog
  6. Nichebot
  7. Yahoo Search Marketing Keyword Selector Tool
  8. Wordpress
  9. Keyword Activity Tool
  10. Total Validator

RSS & Atom Syndication

  • Subscribe to the RWT RSS Feed
  • Subscribe to the RWT Atom Feed

Email Updates

Weekly Blog Updates plus Quarterly Newsletter