How to execute a PHP web page without the .php extension in the URL?

后端 未结 6 804
野趣味
野趣味 2021-02-01 06:24

Sorry for noob question, can\'t understand from what I should search.

I\'m making a site with that page product.php?id=777
I\'d like it to be pro

6条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-01 06:54

    Instead of using mod_rewrite you can also use following in your .htaccess:

     DefaultType application/x-httpd-php 
    

    And just name your script product on the server (without .php file extension).

    So you can invoke it directly and would receive any appended string as $_SERVER["PATH_INFO"]

提交回复
热议问题