2017-10-04 219 views
0

我想将www.example.com/blog重定向到www.example.com/blog/从htaccess。来自.htaccess文件的URL重定向

RewriteRule ^public\/blog$ "https\:\/\/example\.co\/blog\/" [R=301,L] 

如何做到这一点。

感谢名单

+0

的可能的复制[重定向到trailng斜线(htaccess)](https://stackoverflow.com/questions/7267755/redirect-to-trailng-slash-htaccess) – Finwe

回答

0

要使用的.htaccess:

Redirect [URL source] [URL dest] 

所以:

Redirect www.example.com/blog www.example.com/blog/ 

是否应作品不错

一般来说,人们想删除最后的 “/” 和不要添加它。你是否试图在你的所有网页上做到这一点,或只有一个特定的情况?

否则尝试是这样的:(。*)

RewriteEngine叙述上

重写规则^ $ http://www.example.com/ $ 1/[L,R = 301,NC]

+0

我想用这个特定的页面。我使用重定向www.example.com/blog www.example.com/blog/并获得500 –

+0

这应该可行,您是否激活了重写引擎扩展?并验证您的TLD –