Note that there are some explanatory texts on larger screens.

plurals
  1. POCodeigniter htaccess - controllers in subfolder not working
    text
    copied!<p>I am new to CI and don't know much about rewrite rules. I was able to find htaccess rules from stackoverflow post which allows me to remove index.php from the URL. The ht access rules are as following</p> <pre><code>&lt;IfModule mod_rewrite.c&gt; RewriteEngine On RewriteBase /siebeluigen/ #Removes access to the system folder by users. #Additionally this will allow you to create a System.php controller, #previously this would not have been possible. #'system' can be replaced if you have renamed your system folder. RewriteCond %{REQUEST_URI} ^system.* RewriteRule ^(.*)$ /index.php?/$1 [L] #When your application folder isn't in the system folder #This snippet prevents user access to the application folder #Submitted by: Fabdrol #Rename 'application' to your applications folder name. RewriteCond %{REQUEST_URI} ^application.* RewriteRule ^(.*)$ /index.php?/$1 [L] #Checks to see if the user is attempting to access a valid file, #such as an image or css document, if this isn't true it sends the #request to index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?/$1 [L] &lt;/IfModule&gt; &lt;IfModule !mod_rewrite.c&gt; # 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 &lt;/IfModule&gt; </code></pre> <p>But this doesn't work if I move my controllers to subfolder within the controller directly. for example</p> <p>If I put my Application controller in following path</p> <pre><code>application/controllers/application.php </code></pre> <p>Then I can access it from URL</p> <pre><code>http://localhost/siebeluigen/application </code></pre> <p>But if my directory structure is</p> <pre><code>application/controllers/app/application.php </code></pre> <p>Then I get error with following url</p> <pre><code>http://localhost/siebeluigen/app/application </code></pre> <p>but it works like this</p> <pre><code>http://localhost/siebeluigen/index.php/app/application </code></pre> <p>So, I am pretty sure there is something in htaccess that I should be able to change to make it work.</p> <p>Please help!!!</p> <p><strong>Update</strong></p> <p>My htaccess file was in the application folder instead of root. Moving the file to the folder were index.php is located solved the issue. I have marked the answer that is working. Thanks...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload