Mod_Rewrite for GoDaddy and WordPress  

Maya is Driving

I didn't know what image to use for this post

Back in 2008 I posted an article about getting mod_rewrite working on a GoDaddy account. I thought it’d be a good time to update that information with another example. This time we’re going to be looking at making some changes on a GoDaddy account with a WordPress installation.

—————————————-
Options +FollowSymLinks
Options -MultiViews
RewriteEngine on
RewriteRule ^DirectoryName/(.*)/(.*)/(.*) pagename.php?paramB=$2&paramC=$3paramA=$1

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

Options +FollowSymLinksOptions -MultiViewsRewriteEngine onRewriteRule ^attorneys/(.*)/(.*)/(.*) practice.php?geo=$2&pa=$3&state=$1
# BEGIN WordPress<IfModule mod_rewrite.c>RewriteEngine OnRewriteBase /RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]</IfModule>
# END WordPress
DirectoryIndex index.php

—————————————-

This implementation takes this: “domain.com/pagename.php?paramB=Y&paramC=ZparamA=X”
and turns it into “domain.com/DirectoryName/X/Y/Z ”

I like this set up since it fits in with my normal WordPress url structure. Just make sure that you pick a directory name that isn’t going to be used within WordPress.

Also, notice that the custom rules are inserted before the usual WordPress rules. This was the only way I was able to get it to work.

Hope this helps! Just let me know if you have any questions at all.

This entry was posted in Coding and tagged , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>