CodeIgniter Forums
remove compulsory index.php from request URLs - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: remove compulsory index.php from request URLs (/showthread.php?tid=66072)



remove compulsory index.php from request URLs - tmx - 09-01-2016

Hello All,

I am new to CodeIgniter and I'm looking forward to get to know more about this framework. 

I have just completed the static pages tutorial, and now I can access pages of my site (hosted on network NAS) in such a way like  The website itself (and all the framework files) are hosted under the /TestTwo/ directory. My question is, how could I remove that index.php from the url? I have seen some solutions online where they mocked the .htaccess file, I was wondering if there is any other way to achieve this? If there is any instructions on this in some official documentation, it would be nice to see that instead of "raw solutions". I was thinking of editing some configuration file, or the routes.php etc.

I would like to access pages in a manner like http://nas/TestTwo/pages/view

My routes.php is as simple as:
PHP Code:
$route['pages'] = 'pages/view/$1';
$route['translate_uri_dashes'] = FALSE


Cheers,
tmx


RE: remove compulsory index.php from request URLs - PaulD - 09-01-2016

It is well documented here:

http://www.codeigniter.com/user_guide/general/urls.html#removing-the-index-php-file

Make sure you have set your $config['base_url'] in the config file. In your case it looks like your base url would be 'http://nas/TestTwo/'.

Hope that helps,

Paul


RE: remove compulsory index.php from request URLs - tmx - 09-02-2016

(09-01-2016, 01:03 PM)PaulD Wrote: It is well documented here:

http://www.codeigniter.com/user_guide/general/urls.html#removing-the-index-php-file

Make sure you have set your $config['base_url'] in the config file. In your case it looks like your base url would be 'http://nas/TestTwo/'.

Hope that helps,

Paul

Hey,

That did the work. I've just created the .htaccess next to the index.php. Thanks!

Thomas