Search code examples
phpcodeignitercodeigniter-urlcodeigniter-routing

CodeIgniter and Old-style PHP


I have a domain, let's say somedomain.com. I have an admin page somedomain.com/admin. The pages were coded in plain PHP. I recently re-wrote somedomain.com in CodeIgniter. But I do not want to touch somedomain.com/admin for now.

How do I make this work? When I go to somedomain.com/admin, it is looking an admin controller, which of course does not exist. I have an index.php file in admin folder, I cannot figure out a way to access the index file.

Thank you.


Solution

  • You should post .htaccess for us to se. But anyway. You should exclude "admin" to be directed to index.php

    something like this

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
    RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
    RewriteCond %{QUERY_STRING} ^(ACT=.*)$ [NC]
    RewriteRule ^(.*)$ index.php?%1 [L]
    RewriteCond $1 !^(admin|index.php) [NC]
    RewriteRule ^(.*) /index.php?/$1 [L]