Remove .php extension with .htaccess

前端 未结 15 2165
一生所求
一生所求 2020-11-21 04:32

Yes, I\'ve read the Apache manual and searched here. For some reason I simply cannot get this to work. The closest I\'ve come is having it remove the extension, but it point

15条回答
  •  说谎
    说谎 (楼主)
    2020-11-21 05:05

    If you're coding in PHP and want to remove .php so you can have a URL like:

    http://yourdomain.com/blah -> which points to /blah.php

    This is all you need:

    
        RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L]
    
    

提交回复
热议问题