1. htaccess中设置图片防盗链
RewriteEngine on
##################################################
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?php.cn(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp|png)$ http://nothing_phpcn[R,NC,L]
##################################################################################
RewriteCond $1 !^(index\.php|statics|upload|app\.html|robots\.txt)
RewriteRule ^(.*)$ /index.php?/$1 [L]2. htaccess设置404 500错误页
ErrorDocument 404 /statics/home/notfound.html ErrorDocument 500 /statics/home/notfound.html
3. phpstudy伪静态错误No input file specified解决办法
apache No input filespecified,今天是我们配置apache RewriteRule时出现这种问题,解决办法很简单如下
打开.htaccess 在RewriteRule 后面的index.php教程后面添加一个“?”
完整代码如下
.htaccess RewriteEngine on RewriteCond $1 !^(index.php|images|robots.txt) RewriteRule ^(.*)$ /index.php?/$1 [L]
4. Thinkphp非根目录无法加载模块
立即学习“PHP免费学习笔记(深入)”;
.htaccess加RewriteBase /demo2/
\demo2\ThinkPHP\Library\Think\Dispatcher.class.php 119行
define('__INFO__',trim($_SERVER['PATH_INFO'],'/'));之前加:
$_SERVER['PATH_INFO']=str_replace('/demo2','',$_SERVER['PATH_INFO']);5. CI框架伪静态iis-web.config配置参考
6. thinkphp伪静态 去除index.php
采用 php+mysql 数据库方式运行的强大网上商店系统,执行效率高速度快,支持多语言,模板和代码分离,轻松创建属于自己的个性化用户界面 v3.5更新: 1).进一步静态化了活动商品. 2).提供了一些重要UFT-8转换文件 3).修复了除了网银在线支付其它支付显示错误的问题. 4).修改了LOGO广告管理,增加LOGO链接后主页LOGO路径错误的问题 5).修改了公告无法发布的问题,可能是打压
RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
开启路由:
'URL_ROUTER_ON' => true, //URL路由
'URL_MODEL' => 2, // URL模式
7. httpd.ini与.htaccess伪静态规则转换

8. TP正则路由
config.php
'db,htaccess',
.....
);htaccess.php
true, //开启路由
'URL_ROUTE_RULES' => array( //定义路由规则
'/^verifycode\/(\w+)$/'=>'g=Index&c=Verifycode&a=index&type=:1', //验证码
'/^upload_image$/'=>'g=Index&c=Image&a=upload', //教程图片上传按钮
/*登录相关*/
'/^login\/login$/'=>'g=Index&c=Login&a=login', //登录
'/^login\/reg$/'=>'g=Index&c=Login&a=reg', //注册
'/^login\/logout$/'=>'g=Index&c=Login&a=logout', //登录
),
);
return $rules;










