Regex 将网站重定向到移动和阻止图像文件夹
我已在.htaccess中添加了此代码 我不想重定向Regex 将网站重定向到移动和阻止图像文件夹,regex,apache,.htaccess,mod-rewrite,redirect,Regex,Apache,.htaccess,Mod Rewrite,Redirect,我已在.htaccess中添加了此代码 我不想重定向/img/文件夹。。。其他所有目录都希望像此htaccess代码一样重定向移动站点。。请给我这个的代码。。谢谢 我有http://www.exemple.com/img/文件夹 当我尝试从手机加载这些图像时,由于重定向,路径似乎是错误的,即使我使用完整路径调用图像,它也无法工作 /.htaccess RewriteEngine On RewriteBase / #http://stackoverflow.com/questions/36804
/img/
文件夹。。。其他所有目录都希望像此htaccess代码一样重定向移动站点。。请给我这个的代码。。谢谢
我有http://www.exemple.com/img/
文件夹
当我尝试从手机加载这些图像时,由于重定向,路径似乎是错误的,即使我使用完整路径调用图像,它也无法工作
/.htaccess
RewriteEngine On
RewriteBase /
#http://stackoverflow.com/questions/3680463/mobile-redirect-using-htaccess
# Check if m=1 is set and set cookie 'mobile' equal to 1
RewriteCond %{QUERY_STRING} (^|&)m=1(&|$)
RewriteRule ^ - [CO=m:1:%{HTTP_HOST}]
# Check if m=0 is set and set cookie 'mobile' equal to 0
RewriteCond %{QUERY_STRING} (^|&)m=0(&|$)
RewriteRule ^ - [CO=m:0:%{HTTP_HOST}]
# cookie can't be set and read in the same request so check
RewriteCond %{QUERY_STRING} (^|&)m=0(&|$)
RewriteRule ^ - [S=1]
# Check if this looks like a mobile device
RewriteCond %{HTTP:x-wap-profile} !^$ [OR]
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC,OR]
RewriteCond %{HTTP:Profile} !^$
RewriteCond %{QUERY_STRING} !^m=0(?:&|$)
# Check if we're not already on the mobile site
RewriteCond %{HTTP_HOST} !^m\.
# Check to make sure we haven't set the cookie before
RewriteCond %{HTTP:Cookie} !\m=0(;|$)
# Now redirect to the mobile site
RewriteRule ^ http://m.col3negmovie.com%{REQUEST_URI} [R,L]
# Go back to full site
RewriteCond %{HTTP_HOST} ^m\.
RewriteCond %{QUERY_STRING} (?:^|&)m=0(?:&|$)
RewriteRule ^ http://col3negmovie.com%{REQUEST_URI} [R,L]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
在
RewriteBase
行下方添加此处理图像的新规则:
RewriteRule ^img(/.*)?$ - [L,NC]