nginx伪静态改php后缀,nginx伪静态rewrite支持.htaccess

nginx伪静态rewrite支持.htaccess

1. 在需要使用.htaccess文件的目录下新建一个.htaccess文件

这个.htaccess文件一般discuz,dedecms都自带

# .htaccess rewrite  rule

rewrite ^(.*)/archiver/((fid|tid)-[w-]+.html)$ $1/archiver/index.php?$2 last;

rewrite ^(.*)/forum-([0-9]+)-([0-9]+).html$ $1/forumdisplay.php?fid=$2&page=$3 last;

rewrite ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+).html$ $1/viewthread.php?tid=$2&extra=page%3D$4&page=$3 last;

rewrite ^(.*)/profile-(username|uid)-(.+).html$ $1/viewpro.php?$2=$3 last;

rewrite ^(.*)/space-(username|uid)-(.+).html$ $1/space.php?$2=$3 last;

rewrite ^(.*)/tag-(.+).html$ $1/tag.php?name=$2 last;

# end .htaccess rewrite rule

2.

然后修改nginx.conf,在需要添加伪静态的虚拟主机的server{}中引入.htaccess文件

server{

include xxxx/.htaccess;  ##(把这个改成你.htaccess文件的具体位置)

}

重启nginx.conf即可。

相关阅读:

phpstudy 2013 修正版下载

Apache和Nginx如何关闭日志

phpStudy 19种合集 自由切换 + phpfind + phpLight

PHP如何连接Access数据库

mysql Incorrect file format 表修复

phpStudy + phpfind + phpLight 最新PHP集成包全在这里

phpmyadmin出现“Cannot start session without errors”

php环境搭建利器phpStudy实战各种php程序

phpfind 2013.3.15 最新版下载

phpLight 2013.3.15下载

phpStudy 2013.3.23 phpStudy最新版,重写版下载

APACHE支持.htaccess以及 No input file specified解决方案

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值