Remove index.php from url?

Hello,
I want to remove the index.php from the url: http://mywebsite/index.php/.
I use CakePHP pretty URLs, i removed all the .htaccess files:
/.htaccess
/app/.htaccess
/app/webroot/.htaccess
and uncommented the App.baseUrl on the core.php file.
Thank you for your help!

You can control this with routing
$routes->connect(’/’, [‘controller’ => ‘Controller Name’, ‘action’ => ‘index’]);

Hi thank you for your reply. here is my routes.php file.

Router::connect(’/’, array(‘controller’ => ‘reservations’, ‘action’ => ‘index’),array(‘language’ => ‘eng|fra’));
Router::connect(’/searchcars’, array(‘controller’ => ‘reservations’, ‘action’ => ‘searchcars’));
Router::connect(’/:language/:controller/:action/*’,
array(),
array(‘language’ => ‘eng|fra’));
Router::connect(’/:language/:controller’,
array(‘action’ => ‘index’),
array(‘language’ => ‘eng|fra’));

    	   Router::connect('/:language',
                           array('controller' => 'reservations', 'action' => 'index'),
                           array('language' => 'eng|fra'));

    	Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));

...

So your http://sgfrentcar.com/ is working fine. Are you trying to build a link and after clicking on that you are redirected to http://sgfrentcar.com/index.php/? This must be hard-coded and that’s why you are getting this URL. Just follow CakePHP docs properly.

yes all the pages on the website contains the index.php.
here is how I’m adding the links on the menu:

<?php echo $this->Html->link(__('Cars', true), array('controller' => 'reservations', 'action' => 'searchcars')); ?>

What do you mean by hard-coded? Can you explain me please?

In your home page your form action is “/index.php/” which is wrong. It should not like this, if you follow proper syntax you will get “/controller/action” or “/action”

You have to use all things that you removed. You need the .htaccess to do that

Hi thank you guys. Here is my .htaccess files before I removed them.
They worked fine on localhost but on the server I had a 500 server error. That’s why I tried to find another solution by removing them.

.htaccess

RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]

app/.htaccess

RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]

webroot/.htaccess

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]

yes but the others pages don’t work. if the link on the menu redirect me to http://sgfrentcar.com/searchcars without index.php ,it doesn’t work.

Issues like these usually mean ModRewrite isn’t enabled on your server.

Yeah maybe, I will call the hosting provider in this case. thanks

Basically you changed so many things, so revert them first and then just follow the CakePHP docs and you don’t have to worry for anything else.
There is no view file with extension .php it is only have .ctp in CakePHP so definitely if you are writing index.php that means you are doing wrong.

This index.php that he is talking about is in the root folder, not one view file.