简体   繁体   中英

How to rewrite a simple URL in Apache?

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

Try below rule,

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM