rewrite |
location / {
root /home/www/typengine; index index.php index.html index.htm; rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last; rewrite ^([^\.]*)/article-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2 last; rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last; |
|||
DirectoryIndex index.php index.html index.htm pagename.html
RewriteEngine On RewriteBase / RewriteRule ^archiver/((fid|tid)-[\w\-]+\.html)$ archiver/index.php?$1 RewriteRule ^forum-([0-9]+)-([0-9]+)\.html$ forumdisplay.php?fid=$1&page=$2 RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ viewthread.php?tid=$1&extra=page\%3D$3&page=$2 RewriteRule ^space-(username|uid)-(.+)\.html$ space.php?$1=$2 RewriteRule ^tag-(.+)\.html$ tag.php?name=$1 RewriteRule ^index\.html index.php
|
|||
Mailing list ARChives http://marc.info/?l=nginx
正则表达式匹配,其中: * ~ 为区分大小写匹配 * ~* 为不区分大小写匹配 * !~和!~*分别为区分大小写不匹配及不区分大小写不匹配 文件及目录匹配,其中: * -f和!-f用来判断是否存在文件 * -d和!-d用来判断是否存在目录 * -e和!-e用来判断是否存在文件或目录 * -x和!-x用来判断文件是否可执行 flag标记有: * last 相当于Apache里的[L]标记,表示完成rewrite * break 终止匹配, 不再匹配后面的规则 |
|||
PHPCMS,shopex,ECSHOP,WordPress,PHPwind,Discuz在Nginx下的rewrite规则 location / { location / { |
|||
在VPS上装的是口碑较好的 nginx,即LNMP. 但nginx下静态化规则与apache不同,需要重新配置,我目前用到的几款程序的静态化规则如下:wordpress 、supesite、discuz,nginx下静态化规则 ctrl+c +v following |
|||
http://www.blockacountry.com/
选择国家,再点go~ 生成的代码添加到.htaccess里即可。
|
|||
Discuz!在Nginx下的Rewrite |
|||
统一在网站根目录下的.htaccess设置,虽然理论上而言,在Apache中,可以针对每个目录分别设置.htaccess,通过许可权的继承 与覆盖可以实现相当复杂的功能,不过,过多的.htaccess往往会增加管理的难度,修改.htaccess稍有遗漏就可能造成网站出现问题。 默认情况想禁止其它网站盗链,对图片而言,当其他网站使用<img src=”http://yourdomain.com/someimg”>盗链时,会自动重定向,当然,从降低对服务器带宽占用的角度考虑,你可 以简单地拒绝其访问,让其网页上图片位置以红”X”号代替。 允许特定访问来源:单纯针对图片来说,我们也不可能禁止所有除你自己网站之外的其他访问,比如说Google,如果你希望通过Google图片搜索 获得一定的访问的话,必须让其能够正确读取真正的图片,再如应能够让RSS订阅用户看feed中的图片。 运行特定目录下的文件被外部网站使用:完全禁止外部网站有时会带来不便,很大时候,我们自己也可能需要在外部网站使用部分文件,当然,放入这些目录 的文件要有一定的限制,不然,便失去设置防盗链的意义了。 |
|||
location / { |
|||
nginx中如果一个server节点有多个域名,并且在不是访问主域名的情况下如果进行rewrite跳转,会自动把域名转换成主域名。比如: |
|||