小编Ste*_*eve的帖子

在 apache 中删除目录的尾部斜杠

www.example.com/advice/现在有以下网址注意到网址末尾的斜杠了吗?我希望将其删除为类似www.example.com/advice. 现在,当我在浏览器中输入该 URL 时,我会被重定向到带有尾部斜杠的 URL,例如使用 curl 也是如此。现在我知道尾部斜杠被添加了,因为建议是一个实际的目录。

[steve@dev dev.www.example.com]$ curl -I  https://dev.www.example.com/advice -k
  HTTP/1.1 301 Moved Permanently
  Date: Fri, 25 Nov 2016 08:20:11 GMT
  Server: Apache/2.4.6 (CentOS)
  Location: https://dev.www.example.com/advice/
  Cache-Control: max-age=0
  Expires: Fri, 25 Nov 2016 08:20:11 GMT
  Connection: close
  Content-Type: text/html; charset=iso-8859-1
Run Code Online (Sandbox Code Playgroud)
[steve@dev dev.www.example.com]$ curl -I https://dev.www.example.com/advice/ -k
HTTP/1.1 200 OK
Date: Fri, 25 Nov 2016 08:21:19 GMT
Server: Apache/2.4.6 (CentOS)
X-Powered-By: PHP/5.6.27
Set-Cookie: flarum_session=mfbou2hcbvcobhncnaqlvl9bm7; Path=/; HttpOnly
X-CSRF-Token: WV69M1oi8POqOcXi6MvwKhbJQ72Tmo2WpFn3oxwq
Content-Length: 10339
Cache-Control: max-age=0
Expires: Fri, …
Run Code Online (Sandbox Code Playgroud)

mod-rewrite rewrite .htaccess rewritecond apache2

3
推荐指数
1
解决办法
6195
查看次数

标签 统计

.htaccess ×1

apache2 ×1

mod-rewrite ×1

rewrite ×1

rewritecond ×1