douyi8760 2014-05-24 17:03
浏览 23
已采纳

在php和html中重写/掩码url地址

I have read a lot of posts on how to rewrite the urls but still I couldn't find a way to rewrite the following:

www.mysite.com/index.php
www.mysite.com/login.html

to appear only like:

www.mysite.com

Any idea?

  • 写回答

1条回答 默认 最新

  • dongpu2694 2014-05-24 18:48
    关注

    Generally it should be something like:

    <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ index.php?$1 [L,QSA]
    </IfModule>
    

    I suggest you look here Remove 'index.php' from URL with .htaccess for a more specific answer and here for a tutorial

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?