0
votes

greatings...

Question : How to keep index.php in url and hide everything else so my url look like (www.base_url.com/index.php) for every page?

Details : i've searched but i only got how to remove index.php, i think im the only one who want to keep it...lol

im using codeigniter 3 to working on web based app human resource managemen soo i dont need SEO url since the app only accessed by internal employees. i like to make the url clean, only show base_url and the index.php for every page. please show me how to config codeigniter like i need...thank you

1
If you "keep the URL clean", people can't share links to specific pages anymore. That is a bad idea IMO. But if you want to "keep the URL clean", you can always host the real page in an IFRAME tag. - Corion

1 Answers

0
votes

Use .htaccess like this:

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

This will look more cleaner than with index.php. The URL will be like this www.your_baseurl.com/users

and edit your config.php file to use URI like this:

$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';

You can use your route like this:

$route['users'] = 'home/users';