0
我在我的网站/ forumtest/website/page上有一个路径。我希望如果一个文件名为file.php,并且我使用/forumtest/website/page/file.php访问它,htaccess会自动将此URL重定向到/ forumtest/website/page/file。重定向.php为无php htaccess
我一直在寻找几个小时,但我找不到它。我能找到的最接近的就是php扩展程序正在关闭,但不是仍然处于路径/ forumtest/website/page /它只是/(并因此被切断)
由于证明我已经搜索,是不工作的代码:
RewriteEngine on
RewriteBase /forumtest/website/page/
RewriteCond %{THE_REQUEST} \.php
RewriteRule ^(.*)\.php$ $1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
哪里是你的.htaccess文件位于您正在使用? –