我如何删除“的.php”扩展名的网址?扩展名、网址、php

2023-09-02 20:34:26 作者:港风文艺 偏港风的

这是那里的PHP文件是:

ts1.WEBSITENAMEHERE.biz/cp /

.htaccess文件也是这个文件夹中。 我想删除从FILENAME.PHP的.PHP。

这是我目前的'的.htaccess文件:

 选项+了FollowSymLinks
RewriteEngine叙述上
的RewriteBase / CP
重写规则^(。*)/ $ $ 1.PHP
 
如何修改网站的PHP版本

但它不工作。这是为什么?

解决方案

  RewriteEngine叙述上
的RewriteBase / CP /

的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME! PHP $
重写规则。* $ 0.php [L]
 

This is where the PHP files are:

ts1.WEBSITENAMEHERE.biz/cp/

The .htaccess file is also in this folder. I want to remove the '.php' from 'FILENAME.PHP'.

This is my current '.htaccess' file:

Options +FollowSymlinks
RewriteEngine on 
RewriteBase /cp
RewriteRule ^(.*)/$ $1.php

But it is not working. Why is this?

解决方案

RewriteEngine on
RewriteBase /cp/

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