CodeIgniter Forums
.htaccess problems! - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: .htaccess problems! (/thread-10442.html)



.htaccess problems! - El Forum - 07-31-2008

[eluser]Macros[/eluser]
Hi All,

Any help on this will be muchly appreciated!

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

# Put your installation directory here:
# If your URL is www.example.com/example/, use /example/
# If your URL is www.example.com/, 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.


.htaccess problems! - El Forum - 07-31-2008

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



.htaccess problems! - El Forum - 07-31-2008

[eluser]Macros[/eluser]
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