• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
htaccess problem with Multiple Applications

#1
[eluser]Unknown[/eluser]
I am trying to set up a dual-app installation of CI. I have an index.php file for the user app, and an admin.php file for the administrator app. I have run into a problem: I found a StackOverflow question that seemingly has the exact same problem as me, however, the solution that the poster found does not work for me. I have played with the RewriteRules but nothing seems to work. The two rules I have set for redirecting anything with admin at the beginning aren't being met, so the 'catchall' rewrite rule at the bottom meant for the 'app' app redirection. The syntax for the pattern section of RewriteRule seems very straightforward (I'm not THAT bad with regex), so why doesn't it work?

Code:
application/
   admin/
   app/
..
.htaccess
admin.php
index.php

The htaccess rules are:

Code:
RewriteEngine On
RewriteBase /dev/

RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^admin$ admin\.php [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^admin\/(.*)$ admin\.php/$1 [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index\.php/$1 [L,QSA]

Essentially what I need is:

type in example.com/admin - the url keeps the admin folder, and redirect the user to admin.php

type in example.com/admin/controller/method - same as above

type in example.com/anything_else - the user gets directed to the app instead of admin (index.php)

In testing the person in the aforementioned post's htaccess, which mine are essentially copied from, in an online tester, the two rules involving URIs with 'admin' in it are not passed for some reason. I can only get admin (not ^admin$) to work as a pattern (according to the tester).


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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