I have a working path on my Apache2 localhost (linux):
http://localhost/lab/silex/web/index.php/hello/name
I want to become:
http://localhost/lab/silex/hello/name
Now I have Rewrite mode enabled and tested.
I have placed my .htaccess file in my silex/web folder:
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /web/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [L]
</IfModule>
I still cannot see the clean url working.
in your main folder try this: (for you this would be the silex folder)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ web/$1 [QSA,L]
</IfModule>
and in the web folder:
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
RewriteCond %{THE_REQUEST} ^(GET|HEAD)\ /web/
RewriteRule ^(.*)$ /$1 [L,R=301]
</IfModule>
Try this code in your DOCUMENT_ROOT/.htaccess
file:
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_URI} !/lab/silex/web/index\.php/ [NC]
RewriteRule ^(.*)$ /lab/silex/web/index.php/$1 [L]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With