简体   繁体   中英

how to fix url with htacces

我有一个最初为http://web.com/index.php/home/funct/的URL,我想通过删除index.php来更改它,使其变为http://web.com/home/funct/

If you are using Apache server, create a file called .htaccess and put this in it:

<IfModule mod_rewrite.c>
    RewriteEngine on

    # If the file/dir is NOT real go to index
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [QSA,L]
</IfModule>

Then just remove the reference to "/index.php/" from your links and when the server doesn't find "home/funct" it will go looking for "/index.php/home/funct".

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