迅睿工具箱
首页标签
栏目标签
内容标签
表单搜索
其他
css工具
个人笔记
环境规则
nginx环境
location / { if (-f $request_filename) { break; } if ($request_filename ~* "\.(js|ico|gif|jpe?g|bmp|png|css)$") { break; } if (!-e $request_filename) { rewrite . /index.php last; } }
nginx二级目录手机站
location /m/ { if (-f $request_filename) { break; } if ($request_filename ~* "\.(js|ico|gif|jpe?g|bmp|png|css)$") { break; } if (!-e $request_filename) { rewrite . /m/index.php last; } } location / { if (-f $request_filename) { break; } if ($request_filename ~* "\.(js|ico|gif|jpe?g|bmp|png|css)$") { break; } if (!-e $request_filename) { rewrite . /index.php last; } }
apache
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / # 404页面 ErrorDocument 404 /404.html # 不带www跳转到www RewriteCond %{HTTP:Host} ^123.com$ RewriteRule (.*) http://www.123.com/$1 [NC,R=301] # xunruicms RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule !.(js|ico|gif|jpe?g|bmp|png|css)$ /index.php [NC,L] </IfModule>
apache二级目录手机站
<IfModule mod_rewrite.c> RewriteEngine On # 字体图标跨域 <FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|font.css|css)$"> Header set Access-Control-Allow-Origin "*" </FilesMatch> # 二级目录手机站伪静态放在m文件夹下 RewriteBase /m/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule !.(js|ico|gif|jpe?g|bmp|png|css)$ /m/index.php [NC,L] </IfModule>
iis
<rewrite> <rules> <rule name="xunruicms IIS 伪静态" stopProcessing="true"> <match url=".(js|ico|gif|jpe?g|bmp|png|css)$" negate="true" /> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /> </conditions> <action type="Rewrite" url="/index.php" /> </rule> </rules> </rewrite>
iis电脑站和二级目录手机站
<rewrite> <rules> <rule name="xunruicms mobile" stopProcessing="true"> <match url="^mobile/(.*)$" ignoreCase="false"/> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true"/> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true"/> </conditions> <action type="Rewrite" url="/mobile/index.php"/> </rule> <rule name="xunruicms PC" stopProcessing="true"> <match url=".(js|ico|gif|jpe?g|bmp|png|css)$" negate="true"/> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true"/> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true"/> </conditions> <action type="Rewrite" url="/index.php"/> </rule> </rules> </rewrite>
图标与安全
location ~* \.(eot|ttf|woff2|svg|otf|woff)$ { add_header Access-Control-Allow-Origin *; } location ~* /(cache|config|dayrui|template)/ { return 403; } location ~* /(a|uploadfile|static|a|data|style|skin|images|css|js|templets|uploads)/(.*).(php)$ { return 403; }
自动清理缓存和更新缓存
php /www/wwwroot/xxxxxx/api/cron.php
ajax自动清理缓存和更新缓存
{if !is_file(WRITEPATH.'config/run_lock.php')} <script> $(function () { $.ajax({ type: "GET", dataType:"json", url: "{SITE_URL}index.php?s=api&c=run&is_ajax=1&num=5" }); }); </script> {/if}
伪静态规则
TAG插件伪静态
// tag插件 "tag\/index.html" => "index.php?s=tag", "tag\/p([0-9]+).html" => "index.php?s=tag&page=$1", "tag\/(.+)\-([0-9]+)\.html" => "index.php?s=tag&name=$1&page=$2", "tag\/(.+)\.html" => "index.php?s=tag&name=$1",
Sitemap伪静态
// Sitemap 'sitemap.txt' => 'index.php?s=sitemap', 'sitemap.xml' => 'index.php?s=sitemap&c=home&m=xml',
防采集
{"id":"3","type":"1","name":"防采集","value":"{\"module\":\"{modname}.html\",\"list\":\"{modname}/{dirname}/\",\"list_page\":\"{modname}/{dirname}/{page}/\",\"show\":\"{modname}/{my_cjurl($data)}\",\"show_page\":\"{modname}/{id}_{page}.html\",\"search\":\"{modname}/sch.html\",\"search_page\":\"{modname}/sch-{param}.html\",\"catjoin\":\"/\"}"}
其他
大数据随机
{php $mod="mchengyu";} {sql sql='select a.* from @#1_$mod a join (select round((select max(id) from @#1_$mod) * rand()) as rid from @#1_$mod limit 32) b where a.id = b.rid' cache=300 } <li><a href="{$t.url}" title="{$t['title']}">{$t['title']}</a></li> {/sql}