CodeIgniter Forums

Full Version: .htaccess problems!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

Hi All,

Any help on this will be muchly appreciated!

Ok, so I've got an .htaccess file:
# Turn on URL rewriting
RewriteEngine On

# Put your installation directory here:
# If your URL is, use /example/
# If your URL is, use /
RewriteBase /

# Protect application and system files from being viewed
RewriteCond $1 ^(application|system)

# Rewrite to index.php/access_denied/URL
RewriteRule ^(.*)$ index.php/access_denied/$1 [PT,L]

# Allow these directories and files to be displayed directly:
# - index.php (DO NOT FORGET THIS!)
# - robots.txt
# - favicon.ico
# - Any file inside of the images/, js/, or css/ directories
RewriteCond $1 ^(index\.php|robots\.txt|favicon\.ico|images|js|css)

# No rewriting
RewriteRule ^(.*)$ - [PT,L]

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

Then I had the code sitting in a sub folder called "testing" and the RewriteBase line set to /testing/ it all worked fine. The rewrite was working perfectly.

So I moved to to the domain root folder, and changed RewriteBase to /, as in the above. Now all hits to the site go to the default controller, with nothing passed thru. I don't know what's going wrong, but it's like the last line is throwing away the requested parts & just calling index.php.

Has anyone else seen this? Anyone have any ideas as to what is going wrong?

Cheers, Cameron.

El Forum

Try this
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

El Forum

Ah, found the answer on another thread... should've looked first :red:

Hostgator mod_rewrite with CI

Had to change the uri_protocol to REQUEST_URI and it worked perfectly Smile