首页 > 数据库技术 > 详细

Apache htaccess 重写假设文件存在!

时间:2016-01-30 17:48:52      阅读:153      评论:0      收藏:0      [点我收藏+]

假设文件 data/cache/index.html 存在。那么才重写。

否则使用默认的MVC 重写。by default.fu@foxmail.com

RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}/data/cache/list_1.html -f
RewriteRule ^game\/?

$ data/cache/list_1.html [L]


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)$ index.php/$1 [PT,QSA,L]
RewriteRule ^(.*)$ index.php?/$1 [PT,QSA,L]


—————————————————————增强版 正则文件存在就重写 by default.fu@foxmail.com———————————————————

RewriteEngine on

RewriteCond %{DOCUMENT_ROOT}/demo/cache/game_$1.html -f
RewriteRule ^game\/(\d+)\/?$ cache/game_$1.html [L]

RewriteCond %{DOCUMENT_ROOT}/demo/cache/game.html -f
RewriteRule ^game\/?$ cache/game.html [L]

Apache htaccess 重写假设文件存在!

原文:http://www.cnblogs.com/bhlsheji/p/5170885.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!