Activities

August 2010
M T W T F S S
« Jul   Sep »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

codeigniter : .htaccess entry for godaddy shared hosting


RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{HTTP_HOST} ^mydomain.com [NC]
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [L,R=301]

6 comments to codeigniter : .htaccess entry for godaddy shared hosting

  • Eddy Wibowo

    oh yeah, thx your post fix my problem for shared hosting.. I use codeigniter n default code .htaccess for shared hosting like this :
    RewriteEngine on
    RewriteCond $1 !^(index.php|resources|robots.txt)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L,QSA]

    but I dont understand why this is not run well and always get 500 internal error..
    can you explain why? thanks.

  • Eddy Wibowo

    ow I see…

    can you explain to me which line of your code that can make your .htaccess file run well in godaddy?

    I am not good in .htaccess code.. usually I only copy from internet.. thanks.

  • # Options
    Options -Multiviews
    Options +FollowSymLinks

    #Enable mod rewrite
    RewriteEngine On
    #the location of the root of your site
    #if writing for subdirectories, you would enter /subdirectory
    RewriteBase /

    #Removes access to CodeIgniter system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #’system’ can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn’t true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    #This last condition enables access to the images and css
    #folders, and the robots.txt file
    RewriteCond $1 !^(index\.php|images|robots\.txt|css)

    RewriteRule ^(.*)$ index.php?/$1 [L]

  • In the CI config file:
    $config[‘index_page’] = “”;
    $config[‘uri_protocol’] = “AUTO”;

  • this is the best solution for godaddy hosting

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>