suggestion for best htaccess |
[eluser]hcvitto[/eluser]
hi after i few attempt i still haven't found the right htaccess for my app. Here's the structure of the app (codeigniter is installed the default way): CONTROLLERS folder main.php (file contains all the functions) admin (directory for the admin area) -login.php (file for the login inside admin folder) Here's what i'm using at the moment and it works partially, means i can't access subfolder..(unless i use index.php in the url) <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /app_labitta/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/main/$1 [L] </IfModule> <IfModule !mod_rewrite.c> # If we don't have mod_rewrite installed, all 404's # can be sent to index.php, and everything works as normal. # Submitted by: ElliotHaughin ErrorDocument 404 /index.php </IfModule> what should i add to get to: localhost/myapp/admin/login and not to use: localhost/myapp/index.php/admin/login ? Thanks vitto
[eluser]drewbee[/eluser]
Removing the index.php has been discussed many a times on this forum. Search, my man. http://ellislab.com/codeigniter/user-gui.../urls.html You will also have to edit a variable in the config.php file. It contains the value of 'index.php'
[eluser]Rey Philip Regis[/eluser]
Hey... Im not really good at this htaccess file. But this code works for me DirectoryIndex index.php RewriteEngine on RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ ./index.php/$1 [L,QSA] Good day.
[eluser]drewbee[/eluser]
It is not just the htaccess. Their is a configuration variable in the config.php that should be removed as well.
[eluser]Rey Philip Regis[/eluser]
Yah! in the config i did it like this: $config['index_page'] = "";
[eluser]drewbee[/eluser]
Oh ok. You didn't mention that. Is everything setup correctly for you now?
[eluser]hcvitto[/eluser]
ok sorry, i didn't say that, too. i already cancelled 'index.php' in the config file. My problem is i can't access subfolder. Everything is ok for the root but how do i get to the controllers->admin->login.php ? My code alread works fine for the first level VItto
[eluser]drewbee[/eluser]
You create sub directories. /root /root/application/controllers/ <-- first level /root/application/controllers/admin <-- second level Within the admin directory, create a new controller for what ever its purpose may be IE manage_users. So then, /root/application/controllers/admin/manage_users.php is accessed from /admin/manage_users/<parameter>
[eluser]hcvitto[/eluser]
hi drewbee sorry but i didn't explain rightly i meant i can access subdirectory if i use localhost/myapp/index.php/admin/login What i need is an htaccess that lets me use localhost/myapp/admin/login (no index.php) The htaccess i use now just lets me get to the root with no index.php... localhost/myapp/main (this works) Hope this is clearer.. Vitto
[eluser]drewbee[/eluser]
Here is my htaccess. I also have the index.php removed and the subdirectories seem to work just well with this. Do you have code igniter in a lower directory IE myapp? Code: Options +Indexes |
Welcome Guest, Not a member yet? Register Sign In |