Presently, my URL is http://www.example.com/index.php/leadsadmin/login
, and I would like to change it to http://www.admin.example.com
.
I am using the codeigniter framework, and I tried to create a subsite like admin.example.com
and mapped the path it to h:\\root\\home\\...\\modules\\leadsadmin
, but it did not work.
What could I do to achieve this result?
Before answering, I have a doubt in your present URL http:// www.mydomain.com/index.php/leadsadmin/login it might be http:// www.mydomain.com/leadsadmin/login
Ask your service provider to create subdomain admin.mydomain.com and point it to webserver IP address
Then on apache virual host configuration add ServerAlias as follows
ServerAlias admin.mydomain.com // Add this line to your virtual host block.
First, you need to remove index.php from url using .htaccess file
.htaccess file should be
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php?/$0 [PT,L]
Then, in application/config/routes.php file, you need to write
switch ( $_SERVER['HTTP_HOST'] ) {
case 'www.admin.example.com':
$route['default_controller'] = "leadsadmin/login";
break;
default:
// default action
}
try this
RewriteEngine On
RewriteBase /your_project_name
RewriteCond %{REQUEST_URI} ^system.*
RewriteCond $1 !^(index\.php|images|js|uploads|css|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.