CodeIgniter Forums
index.php on subdirectory - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: index.php on subdirectory (/showthread.php?tid=7401)



index.php on subdirectory - El Forum - 04-07-2008

[eluser]Lima[/eluser]
I have developed some web application using CI.
I always put index.php on root directory.
When I installed into my client computer, they have index.php and .htaccess too on root directory.
I think I must move my index.php into subdirectory like /sub, but my application does not work well.

Can anyone help me how to configure .htaccess when I put my index.php on /sub/index.php ?
because when I access http://www.clientsite.com/sub/ CI says "Page not found"


index.php on subdirectory - El Forum - 04-07-2008

[eluser]Pascal Kriete[/eluser]
A really useful thing would be the content of your .htaccess, but assuming you're using the default:
Code:
// Change this:
RewriteRule ^(.*)$ /index.php/$1 [L]
// to:
RewriteRule ^(.*)$ index.php/$1 [L]
// or:
RewriteRule ^(.*)$ /sub/index.php/$1 [L]



index.php on subdirectory - El Forum - 04-07-2008

[eluser]wiredesignz[/eluser]
I prefer option no. 1
Code:
RewriteRule ^(.*)$ index.php/$1 [L]
It works in any situation


index.php on subdirectory - El Forum - 04-07-2008

[eluser]Lima[/eluser]
I'm using CI default configuration.

how about
Code:
RewriteBase /

should be changed to

RewriteBase /sub/



index.php on subdirectory - El Forum - 04-07-2008

[eluser]wiredesignz[/eluser]
Use whichever tickles your pickle. Good luck.

And Welcome to CI forums Wink


index.php on subdirectory - El Forum - 04-07-2008

[eluser]Lima[/eluser]
It realy nice, so simple. I'm using /sub/.htaccess
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|design|css|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]



index.php on subdirectory - El Forum - 04-17-2008

[eluser]Unknown[/eluser]
Sweet. That worked for me too.