Remove .php extension with .htaccess

前端 未结 15 2168
一生所求
一生所求 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:04

    I found 100% working Concept for me:

    # Options is required by Many Hosting
    Options +MultiViews
    
    RewriteEngine on
    
    # For .php & .html URL's:
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^([^\.]+)$ $1.php [NC,L]
    RewriteRule ^([^\.]+)$ $1.html [NC,L]
    

    Use this code in Root of your website .htaccess file like :

    offline - wamp\www\YourWebDir

    online - public_html/

    If it doesn't work correct, then change the settings of your Wamp Server: 1) Left click WAMP icon 2) Apache 3) Apache Modules 4) Left click rewrite_module

提交回复
热议问题