开发者

how to fix url with htacces

开发者 https://www.devze.com 2023-04-08 21:00 出处:网络
I have a url which initially h开发者_Python百科ttp://web.com/index.php/home/funct/ and I want to change this by removing the index.php so that it becomes http://web.com/home/funct/If you are using Apa

I have a url which initially h开发者_Python百科ttp://web.com/index.php/home/funct/ and I want to change this by removing the index.php so that it becomes 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".

0

精彩评论

暂无评论...
验证码 换一张
取 消