虚拟空间iis环境下如何隐藏index.php

虚拟空间iis环境下如何隐藏index.PHP

网上好多教程都是说要改iis环境什么的,但问题是,我只是虚拟空间啊,别人又不会帮你改iis什么的

弄了一天,头都炸了,后来无意间看到一个帖子,配置web.config。瞬间就通透了

就在tp5根目录下写了个config文件。

好了屁话不多说了,直接上代码

自己创建一个web.config文件,代码如下

<?xml version=”1.0″?>

<configuration>

<system.webServer>

<rewrite>

<rules>

<rule name=”OrgPage” stopProcessing=”true”>

<match url=”^(.*)$” />

<conditions logicalGrouping=”MatchAll”>

<add input=”{HTTP_HOST}” pattern=”^(.*)$” />

<add input=”{REQUEST_FILENAME}” matchType=”IsFile” negate=”true” />

<add input=”{REQUEST_FILENAME}” matchType=”IsDirectory” negate=”true” />

</conditions>

<action type=”Rewrite” url=”index.php/{R:1}” />

</rule>

</rules>

</rewrite>

</system.webServer>

</configuration>

 

1、然后tp5入口文件index添加绑定模块来隐藏模块:define(‘BIND_MODULE’,’index’);

2.在application\index\index\controller 添加 Error.php 作为空控制器

代码如下:

<?php
namespace app\index\controller;

use think\Controller;
class Error extends Controller
{
public function index()
{
//header(“HTTP/1.0 404 Not Found”);//使HTTP返回404状态码
//$this->redirect(url(‘index/index/index’)); exit;//返回主页
header( “HTTP/1.1 301 Moved Permanently” ) ;
header(“Location:http://show.millionser.com”);
}
}

3.在application\index\index\controller 修改index.php 作为空操作方法:

public function _empty()
{
header( “HTTP/1.1 301 Moved Permanently” ) ;
header(“Location:http://show.millionser.com”);
//header(“HTTP/1.0 404 Not Found”);//使HTTP返回404状态码
//$this->redirect(url(‘index/index/index’)); exit;//返回主页
}

(文章今日已有 1 人访问,总访问量 7 ::>_<::)
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇