Making WordPress Permalinks Work with Your Server

To ensure the WordPress permalinks for your blog work with your server the .htaccess file on your web server includes specific rules and directives that comply with the permalink structure you choose when you set up your WordPress blog. To use an .htaccess file, you need to know the 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.


You and WordPress work together in glorious harmony to create the .htaccess file that lets you use a pretty permalink structure in your blog. Follow these steps to create an .htaccess file on your web server and create a new permalink structure:




  1. Using a plain-text editor, create a blank file; name it htaccess.txt and upload it to your web server via FTP.


    Common text editors include Notepad for Windows or TextEdit for a Mac.




  2. After the file is uploaded to your web server, rename the file .htaccess and change permissions to either 755 or 777.


    If .htaccess already exists, you can find it in the root of your directory on your web server — 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.


    Because the .htaccess file starts with a period, it may not be visible until you configure your FTP client to show hidden files.




  3. Create the permalink structure in the Customize Permalink Structure page in your WordPress Dashboard.




  4. Click the Save Changes button at the bottom of the Customize Permalink Structure page.


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




If you follow the preceding 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 see that it’s no longer blank. It should contain of code 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

Using permalink structures requires that your web hosting provider has a specific Apache module option called mod_rewrite activated on its servers. If your web hosting provider doesn’t have this item activated on its servers, or if you’re hosting your site on a Windows server, the custom permalinks work only if you type index.php in front of any custom permalink tags.


For example, create the custom permalink tags like this:


/index.php/%year%/%month%/%date%/%postname%/

This format creates a permalink like this:


http://yourdomain.com/index.php/2008/02/01/wordpress-all-in-one-for-dummies


dummies

Source:http://www.dummies.com/how-to/content/making-wordpress-permalinks-work-with-your-server.html

No comments:

Post a Comment