htaccess重定向问题
我有一个用 php 编写的网站。
地址如下:
http://www.site.com/page.php
我愿意任何请求:
www.site.com/page.php
或
www.site.com/page
前往:
www.site.com/page/
(并强制输入www。)
有人可以帮助我吗?
I have a site I've written in php.
The addresses are as follows:
http://www.site.com/page.php
I'd like any request to:
www.site.com/page.php
or
www.site.com/page
To go to:
www.site.com/page/
(And force a www.)
Can anyone help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
对于域:
对于您的第一个目录:
For domain :
For your first directory :
也许这会起作用。
Maybe this will work.
这应该做你想要的:
This should do what you wanted:
蒂姆的答案是最接近的,但它也确实在图像和 css 中添加了尾部斜杠...
因此,采用蒂姆的答案,并稍微编辑它,我们会得到:
哪个应该有效!
Tim's answer is the closest, but it also does adds the trailing slash to images and css...
So taking Tim's answer, and slightly editing it gives us:
Which should work!