我刚刚开始学习正则表达式,但我无法弄清楚这一点。如果 URL 不包含扩展名,我需要在 URL 末尾强制添加斜杠。
更清楚地说:
example.com/test/ stays the same.
example.com/test.php stays the same.
example.com/test becomes example.com/test/ (See the last slash at the end)
谁知道如何解决这个问题?
把它放在你的 .htaccess 上:
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteRule ^/test$ /test/ [L]
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)