apache .htaccess 实现在URL后面自动加 / 利SEO操作

来源:互联网 发布:linux下扫描工具 编辑:程序博客网 时间:2024/06/06 08:44
 

 如何使用apache的重写规则实现 在请求的URL地址后自动加上 / 如:
     http://www.baidu.com
     http://www.baidu.com/

   .htaccess 重写规则如下
   
<IfModule mod_rewrite.c>    <IfModule mod_negotiation.c>        Options -MultiViews    </IfModule>    RewriteEngine On    # Handle Front Controller...    RewriteBase /    RewriteCond %{REQUEST_FILENAME} !-d    RewriteCond %{REQUEST_FILENAME} !-f    RewriteRule ^ index.php [L]    
    # 给每个url地址后追加 /     RewriteBase /    RewriteCond %{REQUEST_FILENAME} !-d    RewriteCond %{REQUEST_FILENAME} !-f    RewriteCond %{REQUEST_URI} !(.*)/$    RewriteRule ^(.*)$ $1/ [L]    </IfModule>

0 0
原创粉丝点击