sorry, but i'am less understand about url rewrite...

i wish to rewrite my url from :
http://localhost/controller/index.php/user/edit
to
http://localhost/controller/user/edit

i makes it with this particular .htaccess :

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

but, the rewrite works if there's no file exist at controller/user/edit.php i would like every request to under my controller/xxx is rewrited to controller/index.php/xxx if the file is exist or otherwise....

i've take away the RewriteCond so my current the first is such as this :

RewriteEngine On
RewriteBase /controller/
RewriteRule ^(.*)$ index.php/$1 [PT,L]

but, it proven internal service error..

You will find several things that do not seem sensible in my experience. Mainly, your question states to wish to rewrite a URL getting index.php inside it to 1 that doesn't, however your rewrite rule, that you simply say works in some instances does the alternative, it pre-pends index.php to demands.

If you can get your apache error and access log, you may find out if there's more details about exactly when the mistake happened -- maybe it was once the .htaccess file was processed, or maybe it was from inside your php program?

I'll think that the aim here's to consider "pretty" web addresses like /controller/user/edit and also have the index.php program really process the /user/edit area of the path.

If that's the case, I believe you might want to set the RewriteBase to /, and alter your .htaccess to

RewriteEngine On
RewriteBase /
RewriteRule ^(.*)$ controller/index.php/$1 [PT,L]

The RewriteBase / directive states that demands are in accordance with the server's DOCUMENT_ROOT setting. The modification towards the rewrite rule instructs all demands to visit your directory controller and file index.php, appending the initial asked for path later on.

(Note: I do not think you need to make use of the PT flag within this situation, and it might be better form to flee the . the industry regex operator as index\.php, however i think neither of those are highly relevant to the issue here)

It's not obvious should you choose want the / prior to the $1. In case your PHP program (index.php) gets known as by using it present, and understands how to handle it, then it is fine, but it is just a little unusual, there might be cases when you finish track of multiple /'s from inside the php program.

But you may not do? The normal utilisation of the RewriteCond %{REQUEST_FILENAME} !-f would be to handle cases for example image files and css or javascript files which are static and do not need to be handled because of your controller. RewriteCond %{REQUEST_FILENAME} !-d is dependent in your system (but it is purpose to determine the request isn't for any directory).

Anyway, the fundamental change when i suggested may help, but when not, possibly you are able to clarify your intent and supply some actual Web addresses along with a look inside index.php