DevHow: Code Snippets from all around

htaccess for removing index.php on a Godaddy host

Tag(s): Codeigniter HTACCESS

An htaccess file for removing index.php on a Godaddy host

# Turn on URL rewriting

# Installation directory
#RewriteBase /

# Allow any files or directories that exist to be displayed directly
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d

# Rewrite all other URLs to index.php/URL
#RewriteRule ^(.*) index.php?/$1 [L]

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteBase /

    RewriteCond $1 !^(index\.php|stylesheets|javascripts|uploads|images|robots\.txt|favicon\.ico)
    RewriteRule ^(.*)$ index.php/$1 [L,QSA]
    RewriteRule /favicon\.ico /images/favicon.ico [L]

    SetEnv mod_rewrite_enabled 1
</IfModule>
<IfModule !mod_rewrite.c>
    SetEnv mod_rewrite_enabled 0
</IfModule>

Comments

You must be logged in to comment