Browse

Web Africa Knowledge Base

Have a question about our products and services?

Tools

Permalinks With ISAPI Rewrite For Wordpress

Problem/Summary

With Wordpress installations or many other CMS Applications you might have links that look like any of the following:

http://www.dlonra.co.za/?id=2567

or

http://www.dlonra.co.za/index.php/books/

Resolution

What needs to be done is to create a httpd.ini file which uses ISAPI Rewrite to reformat your URLs nicely so they will look like:

http://www.dlonra.co.za/books


Here is the code

[ISAPI_Rewrite]

RewriteEngine On

RewriteBase /
RewriteCond ${REQUEST_FILENAME} !-f
RewriteCond ${REQUEST_FILENAME} !-d
# For special Wordpress folders (e.g. theme, admin, etc.)
RewriteRule /wp-(.*) /wp-$1 [L]

# For all Wordpress pages
RewriteRule ^/$ /index.php [L]
RewriteRule /(.*) /index.php/$1 [L]

If you"d like to create permalinks for subfolders aswell the following can be used:

Example:
http://www.url.com/index.php/category/latest-news/ cannot be rewritten as http://www.url.com/category/latest-news/

[ISAPI_Rewrite]

RewriteEngine On

RewriteBase /
RewriteCond ${REQUEST_FILENAME} !-f
RewriteCond ${REQUEST_FILENAME} !-d
RewriteRule /wp-(.*) /wp-$1 [L]
RewriteRule ^/$ /index.php [L]
RewriteRule /category/(.*) /index.php?category_name=$1 [I,U,O]
RewriteRule ^/(.*)$ /index.php/$1 [L]

Did this answer your question?
Yes No
Additional Info