doufu5401
2015-06-16 12:54 阅读 48

删除网址上的文件扩展名

Good day! Got a lot of questions here but i guess i can't ask it all at once so i'll start with the problem i am facing now. So, I am new to .htaccess and I don't know how or if it is possible to remove the file extensions on url, like for example I am accessing my home page in this url "www.sniper.com/home.php", so the question is clear. Is it really possible to use .htaccess to remove the file extension so that when you are at homepage the url will look just like "www.sniper.com/home" ?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • duanboshe0001 duanboshe0001 2015-06-16 12:56

    To remove .php extension

        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^([^\.]+)$ $1.php [NC,L]
    
    点赞 评论 复制链接分享

相关推荐