htaccess的 - 删除尾随期 [英] htaccess - Remove trailing period

查看:227
本文介绍了htaccess的 - 删除尾随期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何删除与htaccess的结尾句点?

如果访问者进入 http://example.com/mypage 。它会给一个404错误。我已经在我的htaccess文件如下:

 重写规则^ \ HTML $ HTTP(*)://例/ $ 1 [R,L]
重写规则^(。*)\。HTM $ http://example.com/$1 [R,L]
 

我认为这样做会工作,但它不会:

 重写规则^(。*)\。$ http://example.com/$1 [R,L]
 

在此先感谢。

解决方案

 重写规则^(。+)\。$ http://www.example.com/$1 [R = 301中,L]
 

将删除尾随点

How do I remove the trailing period (dot) with htaccess?

If a visitor goes to http://example.com/mypage. it'll give a 404 error. I already have the following in my htaccess file:

RewriteRule ^(.*)\.html$ http://example/$1 [R,L]
RewriteRule ^(.*)\.htm$ http://example.com/$1 [R,L]

I assumed adding this would work, but it doesn't:

RewriteRule ^(.*)\.$ http://example.com/$1 [R,L]

Thanks in advance.

解决方案

RewriteRule ^(.+)\.$ http://www.example.com/$1 [R=301,L]

will remove a trailing dot

这篇关于htaccess的 - 删除尾随期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆