Remove .php extension with .htaccess

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

    Gumbo's answer in the Stack Overflow question How to hide the .html extension with Apache mod_rewrite should work fine.

    Re 1) Change the .html to .php

    Re a.) Yup, that's possible, just add #tab to the URL.

    Re b.) That's possible using QSA (Query String Append), see below.

    This should also work in a sub-directory path:

    RewriteCond %{REQUEST_FILENAME}.php -f
    RewriteRule !.*\.php$ %{REQUEST_FILENAME}.php [QSA,L]
    

提交回复
热议问题