CodeIgniter Forums
Unusual Situation: Non-CI subfolder within CI - how to access it directly? - 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: Unusual Situation: Non-CI subfolder within CI - how to access it directly? (/showthread.php?tid=29925)



Unusual Situation: Non-CI subfolder within CI - how to access it directly? - El Forum - 04-26-2010

[eluser]behdesign[/eluser]
I have an unusual situation - I'm replacing the admin interface of a website with CI-based code. As I'm replacing the interface, I'm ajaxing in all of the CI forms, etc from CI. In order to get around cross-domain issues, I've decided to put the existing admin code and CI together in the same subdomain, with CI in a subfolder.

The problem is this: that the existing admin code uses a very crude cookie-based authentication, and any ajax request to get to CI is redirected by the existing code to a login screen.

So I thought perhaps I could flip the script: put CI in the root of the subdomain, and the admin code in an /admin subdirectory off the root. The question is: how do I alter the .htaccess (or CI) to let requests to the /admin subdirectory go through?


Unusual Situation: Non-CI subfolder within CI - how to access it directly? - El Forum - 04-26-2010

[eluser]Nir Gavish[/eluser]
please post your current .htaccess file, see what i can do


Unusual Situation: Non-CI subfolder within CI - how to access it directly? - El Forum - 04-26-2010

[eluser]behdesign[/eluser]
Actually, I just gave it a whirl and with the basic .htaccess to clean up CI, it works fine - as long as the request goes to a valid file in the /admin folder, the request is fine.


Unusual Situation: Non-CI subfolder within CI - how to access it directly? - El Forum - 04-26-2010

[eluser]danmontgomery[/eluser]
Code:
RewriteEngine On
RewriteBase /
RewriteCond $1 ^(file1|folder2|folder3)
RewriteRule ^(.*)$ - [PT,L]

# Rewrite all other URLs to index.php/URL
RewriteRule ^(.*)$ index.php/$1 [PT,L]

Where the first line is a list of files/folders not to rewrite... So, yours could look something like:

Code:
RewriteEngine On
RewriteBase /
RewriteCond $1 ^(index\.php|robots\.txt|favicon\.ico|admin)
RewriteRule ^(.*)$ - [PT,L]

# Rewrite all other URLs to index.php/URL
RewriteRule ^(.*)$ index.php/$1 [PT,L]

[edit]

^^ or that Wink