How to Make WordPress Permalinks Work with Your Server

After you set the format for the permalinks for your WordPress site by using any options other than the default, WordPress writes specific rules, or directives, to the .htaccess file on your web server. The .htaccess file in turn communicates to your web server how it should serve up the permalinks, according to the permalink structure you’ve chosen. To use an .htaccess file, you need answers to two questions:

  • Does your web server configuration use and give you access to the .htaccess file?

  • Does your web server run Apache with the mod_rewrite module?

If you don’t know the answers, contact your hosting provider to find out.

If the answer to both questions is yes, continue with the following steps.

You and WordPress work together in glorious harmony to create the .htaccess file that lets you use a pretty-permalink structure in your blog. The file works like this:

  1. Locate the .htaccess file on your web server or create one and put it there.

    If .htaccess already exists, you can find it in the root of your directory on your web server — that is, the same directory where you find your wp-config.php file. If you don’t see it in the root directory, try changing the options of your FTP client to show hidden files.

    If you need to create the file and put it on your web server, follow these steps:

    1. Using a plain-text editor (such as Notepad for Windows or TextEdit for a Mac), create a blank file and name it htaccess.txt.

    2. Upload htaccess.txt to your web server via FTP.

    3. Rename the file .htaccess (notice the period at the beginning), and make sure that it is writable by the server by changing permissions to either 755 or 777.

  2. Create the permalink structure in the Permalink Settings page on your WordPress Dashboard.

  3. Click the Save Changes button at the bottom of the Permalink Settings page.

    WordPress inserts into the .htaccess file the specific rules necessary for making the permalink structure functional in your blog.

If you followed these steps correctly, you have an .htaccess file on your web server that has the correct permissions set so that WordPress can write the correct rules to it. Your pretty-permalink structure works flawlessly. Kudos!

If you open the .htaccess file and look at it now, you’ll see that it’s no longer blank. It should have a set of code in it called rewrite rules, which looks something like this:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

If you’d like to unlock more mysteries about .htaccess, check out the “Comprehensive Guide to .htaccess.”

  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus
How to Organize Your WordPress Links List
Interacting with Readers through Comments on Your WordPress Blog
How to Organize Links on Your WordPress Blog
How to Create a Navigation Menu in WordPress Twenty Thirteen
Moderate and Manage Comments and Trackbacks on Your WordPress Blog
Advertisement

Inside Dummies.com