htaccess的 - 删除尾随期htaccess

由网友(八个字的优雅好听)分享简介:我如何删除与htaccess的结尾句点?如果访问者进入 http://example.com/mypage 。它会给一个404错误。我已经在我的htaccess文件如下:重写规则^ \ HTML $ HTTP(*)://例/ $ 1 [R,L]重写规则^(。*)\。HTM $ http://example.com/$...

我如何删除与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

阅读全文

相关推荐

最新文章