我找到了几篇有关如何在.htaccess脚本中使用mod rewrite删除文件扩展名的文章,但理想情况下,我想同时删除扩展名和文件名。
例如,wearedeja.com / index.html应该显示wearedeja.com
显然,诸如apple.com之类的网站可以做到这一点,因此即使复杂也必须做到这一点。
我已经搜索并搜索了堆栈溢出和关闭,似乎除了删除扩展之外找不到更多。任何帮助都非常感谢。
好像您的服务器使用nginx作为服务器,而不是apache:
我认为这应该工作:
index index.html index.php;
location / {
rewrite ^/(.*)index\.(php|html?)$ /$1 redirect;
}
那应该添加到你的nginx配置中
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句