联系官方销售客服
1835022288
028-61286886
求技术达人帮我审核并修正完善htaccess里面的错误
我是在linux+apache虚拟主机下用的迅睿。所谓m.域名绑定子目录mobile,是为了虚拟主机条件下移动端能生成静态。
===第1个:根目录下的htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# 绑定 m.jxthermotex.com 到子目录 m
RewriteCond %{HTTP_HOST} ^m\.jxthermotex\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/mobile/
RewriteRule ^(.*)$ mobile/$1?Rewrite [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
</IfModule>
<FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|svg|font.css|css)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>
RewriteCond %{HTTP_USER_AGENT} ^.*MSNBot.* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*Slurp.* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*Teoma.* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*twiceler.* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*Gigabot.* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*Scrubby.* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*Robozilla.* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*Nutch.* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*ia_archiver.* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*naverbot.* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*yeti.* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*youdaobot.* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*yahoo-mmcrawler.* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*psbot.* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*asterias.* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*bingbot.* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*AhrefsBot.* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*Bytespider.* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*YandexBot.* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*NetcraftSurveyAgent.* [NC]
RewriteRule ^(.*)$ http://www.googel.com/ [L]
===第2个:/mobile目录下的htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#只许绑定的域名访问
RewriteCond %{HTTP_HOST} !^m\.jxthermotex\.com$ [NC]
RewriteRule (.*) http://m.jxthermotex/$1 [R=301]
#对绑定目录下与同名的目录的处理
RewriteCond %{REQUEST_URI} ^\/mobile\/ [NC]
RewriteCond %{QUERY_STRING} !^(.*)?Rewrite
RewriteRule ^(.*)$ /%{REQUEST_URI}/%{REQUEST_URI}/$1?Rewrite [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
<FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|svg|font.css|css)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>