How to rewrite a simple URL in Apache?

66 Views Asked by At

If I have an URL like this: http://localhost/sewacp/web/index.php

How can I eliminate /web/index.php so it'll be http://localhost/sewacp?

I wrote .htaccess like this but it didn't work:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . web/index.php
1

There are 1 best solutions below

0
On

Try below rule,

RewriteEngine On
RewriteRule ^$ /sewacp/web/index.php [QSA,L]