总结一下隐藏index.php文件的步骤
1.开启apache的mod_rewrite模块
去掉LoadModule rewrite_module modules/mod_rewrite.so前的“#”符号
确保<Directory "..."></Directory>中有“AllowOverride All”
2.在项目中的/protected/config/main.php中添加代码:
'components'=>array(
...
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,//注意false不要用引号括上
'urlSuffix'=>'.html',
'rules'=>array(
'sites'=>'site/index',
),
),
...
),
复制代码
3.在与index.php文件同级目录下添加文件“.htaccess”,内容如下:
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
复制代码
这样就可以实现隐藏index.php入口文件了。
分享到:
相关推荐
1,心血来潮,把ThinkPHP项目部署到了nginx上,以上是在apache上跑的。突然发现nginx不支持pathinfo功能,难怪在TP中调怎么都没管用。 2,开始上文件了,比网上其他一些杂的好多了: ...include index.php.con
把ThinkPHP中隐藏index.php文件的方法分享给大家,希望大家把ThinkPHP学得更好1
ci 隐藏 index.php 以及 设置路由
vue-cli中config目录下的index.js文件详解
phpstudy如何隐藏index.php 找到打开 vhosts-ini location / { **if (!-e $request_filename) { rewrite ^/(.*)$ /index.php/$1 last; }** index index.html index.htm index.php; #autoindex on; } 在配置...
wangeditor 中index.js文件
index.lock文件是在.git下面, 而.git是一般是隐藏的, 那么可以通过以下命令删除即可. rm -rf /Users/dianji/project/ccpay.h5/.git/index.lock ///Users/dianji/project/ccpay.h5/.git/index.lock是你的index.lock...
本文所写的配置在ThinkPHP3.2.2上测试过。按理也兼容其它版本。 首先修改配置文件: ‘URL_CASE_INSENSITIVE’ => true, // 默认false 表示URL区分大小写 true则表示不区分大...try_files $uri $uri/ /index.php?s=$u
Index.DAT File Viewer V2.1 汉化版 一款可以查看index.dat文件的数据探测工具,即使你清除了IE缓存和Cookie,使用它依然可以通过对index.dat文件的解析获取这些信息。
Nginx配置PATHINFO隐藏index.php Nginx配置文件里放入这段代码 server { listen 80; default_type text/plain; root /var/www/html; index index.php index.htm index.html; #隐藏index.php location / { if...
ThinkPHP 作为 PHP 框架,是单一入口的,那么其原始的 URL 便不是那么友好。但 ThinkPHP 提供了各种机制来定制需要的 URL 格式,配合 Apache .htaccess 文件,更是可以定制出人性化的更利于 SEO 的 URL 地址来。
你知道在C:Documents and Settings用户名Local SettingsTemporary Internet FilesContent.IE5文件夹下的index.dat文件吗? <br>不用找了,看不到的,打开查看所有文件也看不到,在Temporary Internet Files...
index.css
index.php
主要介绍了yii2 url重写并隐藏index.php方法,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
vuex学习详细源码 实现store/index.js文件的详细拆分
主要介绍了Nginx隐藏index.php和Pathinfo模式配置例子,需要的朋友可以参考下
今天小编就为大家分享一篇laravel5环境隐藏index.php后缀(apache)的方法,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧