سؤال

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.

هل كانت مفيدة؟

المحلول

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]

نصائح أخرى

Like this :

RewriteEngine On
RewriteBase /
RewriteCond $1 !^(index\.php|assets|thirdparty|admin|themes|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top