隐藏index.php

以 Apache 为例,需要在入口文件的同级添加 .htaccess 文件(官方默认自带了该文件),内容如下:
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>

如果使用的 apache 版本使用上面的方式无法正常隐藏 index.php ,可以尝试使用下面的方式配置
.htaccess 文件:
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
</IfModule>

时间: 2024-08-30 09:24:36

隐藏index.php的相关文章

【铜】第135篇 一对一视频录制(二)及必填项红色星标及隐藏index.php及必选项不能为空 周一

关键词:一对一视频录制, 必填项红色星标, 隐藏index.php, 必选项不能为空 一.一对一视频录制 1.1 需要做的 二.我的网站 2.1 必填项红色星标 代码如下: <spanstyle="color:red;">*</span> 效果如下: 2.2 隐藏index.php 1)开启mod_rewrite.so LoadModule rewrite_modulemodules/mod_rewrite.so 注:去掉前面的#,重启apache即可. 2)如

nginx 404页面处理以及pathInfo和隐藏index.php总述

今天开发公司官网:http://www.zstime.com/,遇到一个问题,如何在nginx下设置pathInfo以及如何隐藏index.php 这里分别来讲解一下: 一.隐藏index.php 隐藏index.php需要修改nginx的配置文件,如果你是使用vhost的,需要修改如conf/vhost/你的文件名.conf 文件,整个文件如下 server { listen 80; server_name www.zstime.com; index index index.html inde

CI 框架隐藏index.php-ubuntu

和朋友在做一个小网站,用到了CI框架,之前测试都是在windows上,隐藏index.php也相对比较简单.但服务器是ubuntu系统,需要配置一下,根据网上看到的一些教程,结合自己电脑的特点,记录步骤如下: 1.服务器环境: ubuntu12.04  64位 2.开启mod_rewrite模块: 修改 /etc/apache2/sites-enabled/000-default,将其中的:AllowOverride None 修改为:AllowOverride All,如下: Document

Yii2简单地址美化并隐藏index.php

目的:我只想去掉浏览器地址栏中的index.php?r=这一块. 在/config/web.php中 ’components'=>[] 中添加如下代码: 1 'urlManager' => [ 2 'enablePrettyUrl' => true, 3 'showScriptName' => false,//隐藏index.php 4 //'enableStrictParsing' => false, 5 'suffix' => '.html',//后缀,如果设置了此

Nginx配置PATHINFO隐藏index.php

1.网络来源:http://www.shouce.ren/post/view/id/1529 server {      listen       80;     default_type text/plain;     root /var/www/html;     index index.php index.htm index.html; #隐藏index.php     location / {           if (!-e $request_filename) {         

thinkphp中redirect重定向后隐藏index.php

首先,.htaccess文件要配置好隐藏index.php.系统默认生成的就行. 然后,也是最关键的一部,要在Application/Home/Conf里的config.php文件中增加如下配置: <?php return array( //'配置项'=>'配置值' 'URL_MODEL' => '2' ); 这样就好了.

[转]ThinkPHP5 隐藏index.php问题

ThinkPHP5 隐藏index.php问题 Apache,修改.htaccess文件 ----------------------------------------------------- RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]变成RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L] Nginx,修改配置文件nginx.conf ----------------------------------------

thinkphp隐藏index.php/home,并允许访问其他模块

想要达成的效果很简单,我有两个模块,Home.Wechat. http://localhost/index.php/home/index/index 缩短为: http://localhost/index/index http://localhost/index.php/wechat/index/index 缩短为: http://localhost/wechat/index/index 隐藏index.php,这个比较简单,我开启.htaccess的支持就行,具体配置执行百度吧,我用的是apa

Ubuntu下配置ThinkPHP隐藏index.php

http://doc.thinkphp.cn/manual/url_rewrite.html 以上连接为框架手册提供的步骤,而Ubuntu下apache环境与windows及其它Linux有一定区别 1.开启mod_rewrite.so模块 使用sudo a2enmod,可配置模块管理,再输入rewrite,则开启了mod_rewrite.so模块. 2.AllowOverride 改为All sudo vim /etc/apache2/apache2.conf,开启找到AllowOverrid