I use Silex's "micro-framework" for routing purposes of my application. I am now obsessed with how to rewrite a URL using .htaccess.
Silex standard URL: localhost/myapp/web/index.php/hello/name
I want it to look like this: localhost/myapp/hello/name
With the following .htaccess code, I can omit the /index.php/ part. But I still need to use the /web/ .
RewriteEngine On RewriteCond %{THE_REQUEST} /myapp/web/index.php/ RewriteRule ^/myapp/web/index.php/(.*) /myapp/$1 [R=301,L] RewriteCond %{REQUEST_URI} !/myapp/web/index.php/ RewriteRule ^(.*)$ /myapp/web/index.php/$1 [L]
Any suggestions? Thanks!
source share