CodeIgniter Forums
.htaccess woes - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: .htaccess woes (/showthread.php?tid=13692)



.htaccess woes - El Forum - 12-02-2008

[eluser]ryeguy[/eluser]
I can't seem to get this to work. I searched and searched the forums, tried all the replies, and nothing worked.

I have my CI installed at www.mysite.com/ci/.

On my server, PHP is running in CGI mode, so I have edited php.ini files in every subdirectory with cgi.fix_pathinfo=0 (as per another thread). Do I need this, and if so, do I need a php.ini in every folder or just mysite.com/ci/?

My .htaccess is this:
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /ci/index.php/$1 [L]

Config.ini:
Code:
config['index_page'] = "";

At this point for some reason when I go to ANY page in mysite.com/ci, I get "No input file specified". Even when using index.php to route to my controller!

UPDATE:
I removed cgi.fix_pathinfo=0 and set it back to 1 and I no longer get the error if I use index.php. I still get it if I try to do it without index.php.


.htaccess woes - El Forum - 12-02-2008

[eluser]LuckyFella73[/eluser]
hi ryeguy,

I'm no htaccess expert, but in my projects running in
a subfolder, I edit my confic.php this way:
Code:
$config['base_url'] = "http://www.myproject.com/subfolder/";

and don't write the subfolder into htaccess:
Code:
RewriteRule ^(.*)$ /index.php/$1 [L]

instead of:
Code:
RewriteRule ^(.*)$ /subfolder/index.php/$1 [L]

I don't know if that work for you ..
on some webservers url rewriting only works with following htaccess:
Code:
<IfModule mod_rewrite.c>
    # Turn on the Rewrite Engine
    RewriteEngine On
    
    # If the file or directory exists, show it
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^(.+) - [PT,L]
    
    # Blank queries get sent to the index
    RewriteRule ^$ index.php [L]
    
    # All other queries get sent to the index as index.php/whatever
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>



.htaccess woes - El Forum - 12-02-2008

[eluser]ryeguy[/eluser]
Thank you so much! That worked perfectly!