.htaccess 常用规则

location /{
	  if ($request_uri  !~*  \.xml|\.html$) { 
    rewrite ^(.*[^/])$ $1/ permanent;
    }
    
	if (!-e $request_filename) {
	   rewrite  ^(.*)$  /index.php/$1  last;
	   break;
	}

}

以上伪静态末尾自动加反斜杠

RewriteEngine on
RewriteBase /
#如果不是目录,才会执行下一条RewriteRule
RewriteCond %{REQUEST_FILENAME} !-d
#如果不是文件,才会执行下一条RewriteRule
RewriteCond %{REQUEST_FILENAME} !-f
#判断url是否以斜杠“/”结尾;
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ $1/ [L,R=301]

RewriteRule ([\x80-\xffa-zA-Z]{1,})-([0-9]{1,})-([a-zA-Z]{1,}).html$ test.php?action=$1&id=$2&ac=$3
#RewriteRule ^about(/?)$ ?ac=about
RewriteRule ^about(/?)$ ?ac=about
RewriteRule ^histroy(/?)$ ?ac=histroy

/uploadfile/10/file/20201107/20201107155730_60472.txt


发表评论 已发布 0

还可以输入 800 个字
 
 
打印