问:我想把上面的和下面那段合并在一起 .htaccess 应该怎么弄?
<IfModule mod_rewrite.c>RewriteEngine OnRewriteCond %{HTTP:From-Https} !^on$ [NC]RewriteCond %{HTTP_HOST} ^(www.)?mgmg.com.cn$ [NC] # 将mgmg.com.cn和www.mgmg.com.cn跳转到https://www.mgmg.com.cn,防止apache子站继承上级目录.htaccess受影响RewriteRule ^(.*)$ https://www.mgmg.com.cn/$1 [R=301,L]</IfModule>
=========================================================
RewriteEngine OnRewriteRule ^list-([0-9] ).html$ /plus/list.php?tid=$1RewriteRule ^list-([0-9] )-([0-9] )-([0-9] ).html$ /plus/list.php?tid=$1&totalresult=$2&PageNo=$3RewriteRule ^([0-9] ).html$ /plus/view.php?arcID=$1RewriteRule ^view-([0-9] )-([0-9] ).html$ /plus/view.php?aid=$1&pageno=$2
#防止模板下载RewriteRule templets/(.*).(htm)$ – [F]
#设置默认主页及404页面<Files ~ \”^.(htaccess|htpasswd)$\”>deny from all</Files>ErrorDocument 404 /index.phporder deny,allowDirectoryIndex index.html index.php
#屏蔽 uploads,data,templets 三个目录执行php能力RewriteRule uploads/(.*).(php)$ – [F] RewriteRule data/(.*).(php)$ – [F] RewriteRule templets/(.*).(php)$ – [F]
答:您好
直接将下面的代码复制到 </IfModule>之前就可以。如图,请您保存后再试下,,非常感谢您长期对我司的支持!
<IfModule mod_rewrite.c>RewriteEngine OnRewriteCond %{HTTP:From-Https} !^on$ [NC]RewriteCond %{HTTP_HOST} ^(www.)?mgmg.com.cn$ [NC] # 将mgmg.com.cn和www.mgmg.com.cn跳转到https://www.mgmg.com.cn,防止apache子站继承上级目录.htaccess受影响RewriteRule ^(.*)$ https://www.mgmg.com.cn/$1 [R=301,L]
RewriteEngine OnRewriteRule ^list-([0-9] ).html$ /plus/list.php?tid=$1RewriteRule ^list-([0-9] )-([0-9] )-([0-9] ).html$ /plus/list.php?tid=$1&totalresult=$2&PageNo=$3RewriteRule ^([0-9] ).html$ /plus/view.php?arcID=$1RewriteRule ^view-([0-9] )-([0-9] ).html$ /plus/view.php?aid=$1&pageno=$2#防止模板下载RewriteRule templets/(.*).(htm)$ – [F]#设置默认主页及404页面ErrorDocument 404 /index.php#屏蔽 uploads,data,templets 三个目录执行php能力RewriteRule uploads/(.*).(php)$ – [F] RewriteRule data/(.*).(php)$ – [F]
RewriteRule templets/(.*).(php)$ – [F]</IfModule>