简体   繁体   中英

Correct way to remove index.php in URLs

I'm currently learning fuel php and I've searched a lot in google all day long and still can't find a solution on how to remove index.php in URLs. That is, instead of localhost/project/public/index.php/hello I only need to write: localhost/project/public/hello I'm currently doing the tutorial here and when I clone their repository I'm getting a 404 error not found due to there URL having no index.php. How can I do that? I'm using WAMP server.

Try to add this .htaccess file to your web directory:

Options +FollowSymLinks

RewriteEngine On

RewriteRule ^(.*)$ index.php [NC,L]

Create an .htaccess in the top level directory and add:

<IfModule mod_rewrite.c>
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^ index.php [L]
</IfModule>

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