[英]Removing .php extensions from sub-directory and sub-sub-directory via .htaccess
Below are the example links with current sub directories, as you can see below the htaccess code I'm using 下面是带有当前子目录的示例链接,如您所见,下面是我正在使用的htaccess代码
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [L]
currently only does the trick for - https://www.example.com/folder1/folder2/page 目前仅适用于-https: //www.example.com/folder1/folder2/page
but not with - https://www.example.com/folder1/page.php 但不能使用-https://www.example.com/folder1/page.php
I'm trying to get both directories to eliminate the .php extension. 我试图获得两个目录,以消除.php扩展名。 Any idea how to go about this, as I have no idea how to do this.
任何想法如何去做,因为我不知道如何去做。 Thanks in advance
提前致谢
i think if %{REQUEST_FILENAME}.php
is not good function. 我认为如果
%{REQUEST_FILENAME}.php
不是很好的功能。 but you can try this 但是你可以试试看
RewriteCond $1 !^(index\.php|images)
RewriteRule ^(.*)$ /folder1/folder2/index.php?$1 [L]
this script will give you output like https://www.example.com/folder1/folder2/your_name_url 该脚本将为您提供类似https://www.example.com/folder1/folder2/your_name_url的输出
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.