I currently working on two applications in one codeigniter installation. The structured of the applications is:
somewebsite.com (main directory)
- webdesktop (directory)
- webmobile (directory)
- index.php (for webdesktop)
- mobile.php (for webmobile)
- .htaccess
I managed to remove the index.php to access the webdesktop app ( http://somewebsite.com/index.php/controller
to http://somewebsite.com/controller
) using these config:
config.php (webdesktop):
$config['base_url'] = 'http://somewebsite.com';
$config['index_page'] = '';
.htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
The problem that I face right know is the url to access webmobile. I currently access it using this url : http://somewebsite.com/mobile.php/controller
.
How to change mobile.php
to just mobile
? so the url to access webmobile can become http://somewebsite.com/mobile/controller
.
Just add this rule at your .htaccess file
RewriteRule ^mobile$ mobile.php
It will read mobile
as mobile.php
. So, if you need other changes to your URL, you can learn about htaccess rules.
Hopefully can help you.
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.