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.

2 Responses to Mod_Rewrite for GoDaddy and WordPress

  1. Amol says:

    Hi,

    My problem is when i click on link on page to go to login page its
    http://www.artbeez.com/index.php/login/ it works fine on local IIS but on godaddy hosting space it displays 404 page not found error. It require URL as
    http://www.artbeez.com/index.php?/login/

    How can i use .htaccess
    to redirect to http://www.artbeez.com/index.php?/login/

    from
    http://www.artbeez.com/index.php/login/

    Please help me. Thanks in advance

  2. Morning,
    I have a problem on godaddy host. I use a url rewriting in “.htaccess” file . I have allways the error :

    Internal Server Error
    The server encountered an internal error or misconfiguration and was unable to complete your request.
    Please contact the server administrator and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    If i delete ùy .htaccess, i see the first page of my site. How can i fix the problème.
    Thos my .htaccess file:
    /********************************************
    # turn URL rewriting on
    RewriteEngine on

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(actions\/login\/openidfinishauth\/ac_login_openidfinishauth\.php)$ $1
    RewriteRule ^(pages\/test\/test\/pc_test_test\.php)$ $1

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)\.js\.php$ $1

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)\_js\.php$ $1

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)\.js$ $1

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)\.css\.php$ $1

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)\_css\.php$ $1

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)\.css$ $1

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

    php_flag session.use_trans_sid off
    ********************************************/
    My site is http://www.cimobiles.com/cigames

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>

Spam protection by WP Captcha-Free