如何从单个页面中删除.php或.html扩展名? [英] How to remove .php or .html extension from single page?
问题描述
我有一个网站
,例如:www.abcd.com,那里有很多页面。
例如:www.abcd.com/one.php,www.abcd.com/two.php
我只想从www.abcd.com/one.php而不是从.php中删除.php其他所有页面。
I have a website eg : www.abcd.com in that there are many pages. eg : www.abcd.com/one.php , www.abcd.com/two.php I just want to remove the .php from www.abcd.com/one.php and not from all the other pages.
我已经在.htaccess文件中尝试过此部分。
I have tried this part in .htaccess file.
`RewriteEngine on
`RewriteEngine on
RewriteCond%{REQUEST_FILENAME}!-d
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond%{REQUEST_FILENAME} .php -f
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(。*)$ $ 1.php`
RewriteRule ^(.*)$ $1.php`
推荐答案
您可以在根目录中使用此规则。 htaccess:
You can use this rule in your root .htaccess:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(one)/?$ /$1.php [L,NC]
这篇关于如何从单个页面中删除.php或.html扩展名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!