如何忽略 .htaccess 中的“/”重写 URL
How to ignore "/" in .htaccess re-write URL
我正在使用 .htaccess 隐藏 .php 中我的文件的扩展名。现在假设我有一个名为 "test.php" 的文件,所以如果用户输入“site.com/test
”,文件 test.php 将被打开。现在无论如何,即使用户写“site.com/test/"
(URL 末尾的斜杠/)被重定向或显示 test.php?我只想让我的网站忽略“/ " 最后。
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.*)/$ / [R=302]
RewriteRule ^test$ /test.php [L]
我正在使用 .htaccess 隐藏 .php 中我的文件的扩展名。现在假设我有一个名为 "test.php" 的文件,所以如果用户输入“site.com/test
”,文件 test.php 将被打开。现在无论如何,即使用户写“site.com/test/"
(URL 末尾的斜杠/)被重定向或显示 test.php?我只想让我的网站忽略“/ " 最后。
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.*)/$ / [R=302]
RewriteRule ^test$ /test.php [L]