Issues with .htaccess with codeigniter...

#1
[eluser]broyd[/eluser]
Hello everyone,
I've tried many different solutions, read a lot all over google and I just cannot seem to understand the issue here, maybe i'm blind for looking for solutions for too long and the answer is right under my nose and i'm too blind to see, I bet it's a joke and very easy too, but here it goes.

I'm runing a script that uses Codeigniter in a subfolder, and with this script I have an .htaccess:

Code:
AddHandler application/x-httpd-php5 .php .php4 .php3 .phtml
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^$ /index.php [L]
RewriteCond $1 !^(index\.php|install|img|smarty|images|scripts|fonts|uploads|css|js|robots\.txt|sitemap\.xml|favicon\.ico)
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteRule (.*)-(.*)\.html$ articles/show/$2
RewriteRule (.*)-(.*)/$ categories/show/$2
RewriteRule /cat_articles/(.*)-(.*)\.html$ categories/articles/$2
RewriteRule (.*)-(.*)\/(.*)$ categories/show/$2/$3
ErrorDocument 404 /404.php
Options -Indexes

Now the issue is the following: When I put a new file in the folder like say test.php and i try to go to it http://www.site.com/test.php I get 404 error and I cannot get the file to load. This happens even if I try to get into a newly made folder http://www.site.com/test/test.php same thing happens.

The odd thing is tho, the files/folders that come with the script work fine, such as http://www.site.com/contact - /login - /register etc but anything I make goes to 404...

When I remove the .htaccess I can access the files / folders then but obviously the structer of the URL is messed up and does not work anymore.

Any help would be appreciated!

EDIT: Sorry, forgot to mention, the config.php is set:

Code:
$config['uri_protocol']    = "ORIG_PATH_INFO";

it's the only method that works, atleast with that .htaccess on Hostgator.

#2
[eluser]broyd[/eluser]
nobody? Sad

#3
[eluser]wiredesignz[/eluser]
Your htaccess rules are messed up. The path to the CodeIgniter sub directory is not in either the RewiteBase or in the RewriteRule so it fails there. Using forward-slash in these places refers to the Root directory only.

Go back to a recommended htaccess (user guide) setup, get it to work and build from there.

Also read up on using Routes in the user guide.

#4
[eluser]Daniel Moore[/eluser]
Also, after checking the User Guide, you may also want to check out my write up on this issue, at http://www.danielwmoore.com/remove_index...odeigniter. It has helped many people that could get it done no other way. The documentation for the .htaccess there should help you to understand what it all really does as well, at least better than what you do now.

#5
[eluser]broyd[/eluser]
Thank you guys, will read up on this tomorrow Smile Hope I can get it all fixed!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.