How to remove all .php extension from a dir and all of its subdirectories?

后端 未结 3 1054
遇见更好的自我
遇见更好的自我 2021-01-27 11:49

My web is dir structured is as follows :

moving/
      includes/
      con

3条回答
  •  故里飘歌
    2021-01-27 12:00

    If all your website files are ending with .php and you want to take off the .php extension, then you should create and .htaccess file, or if you already have it, add this rule:

    RewriteRule ^(([^/]+/)*[^.]+)$ /$1.php [L]

    Supposing your website pages are let's say site/about.php, site/contact.php, site/news.php, the rule above will just transform those to site/about, site/contact, site/news

    Hope it helps!

提交回复
热议问题