如何重定向/的博客/博客/? [英] How to redirect /blog to /blog/?

查看:127
本文介绍了如何重定向/的博客/博客/?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要重定向/的博客/博客/。我有两个条件,如果博客是在URL中第一个条件会叫别人第二个条件。请人帮我做这件事。

I want to redirect /blog to /blog/. I have two condition if blog is in the url first condition will be called else second condition. Please anybody help me to do this.

我这样做。

#blog
RewriteCond %{REQUEST_URI} ^/blog.*
RewriteRule (.*)           /blog/$1   [L]

#squeezepage
RewriteEngine On 
RewriteRule ^([0-9a-zA-Z]+)$ index.php?option=com_squeezepage&sqpage=$1 [NC]

感谢。

推荐答案

您可以做这样的事情来重定向 /博客 /博客/ 但是,如果 /博客是一个物理文件夹,然后阿帕奇自动为您完成:

You can do something like this to redirect /blog to /blog/ however if /blog is a physical folder then Apache does it automatically for you:

RewriteRule ^blog$ /blog/ [L,R=301,NC]

这篇关于如何重定向/的博客/博客/?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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