1.开启apache的mod_rewrite模块
去掉LoadModule rewrite_module modules/mod_rewrite.so前的“#”符号
确保<Directory "..."></Directory>中有“AllowOverride All”
2.在项目中的/protected/config/main.php中添加代码:
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,//注意false不要用引号括上
'urlSuffix'=>'.html', //页面静态化
'rules'=>array(
),
),
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入口文件了。
注: 如果项目不是直接映射到localhost/下,则应该做如下修改,
RewriteRule . index.php----->RewriteRule ^(.*)$ /appstore/index.php/$1 [QSA,PT,L]
分享到:
相关推荐
ThinkPHP 作为 PHP 框架,是单一入口的,那么其原始的 URL 便不是那么友好。但 ThinkPHP 提供了各种机制来定制需要的 URL 格式,配合 Apache .htaccess 文件,更是可以定制出人性化的更利于 SEO 的 URL 地址来。
6、如果提示“使用的域名受限制”将压缩包内的FanweAction.class.php文件覆盖至\admin\Lib\Action路径下,然后在从新打开http://你的网址/admin.php,管理帐号和密码都是:fanwe。 7、系统内带 N个风格 在后台——...
1、httpd.conf配置文件中加载了mod_rewrite.so模块 //在APACHE里面去配置复制代码 代码如下:#LoadModule rewrite_module modules/mod_rewrite.so把前面的警号去掉 2、AllowOverride None 讲None改为 All //在...
环境: php5.5左右吧 mysql 先导入数据库文件db/db.sql 再修改config.php数据库配置 ...Apache的伪静态规则RewriteEngine Onrewritebase /RewriteRule ^index.html /index.php [L,NC]RewriteRule ^
rewrite ^/index.html$ /index.php; rewrite ^/about.html$ /about.php; rewrite ^/search.html$ /search.php; rewrite ^/apply.html$ /apply.php; rewrite ^/404.html$ /404.php; rewrite ^/sort([1-9]+[0-9]*)....
<action type="Rewrite" url="index.php/{R:1}" /> </rewrite> [nginx] 在Nginx低版本中,是不支持PATHINFO的,但是可以通过在Nginx.conf中配置转发规则实现: location / { if (!-e $request_filename)...
开源Thinkphp宅音乐html5在线音乐播放器PHP MySQL音乐播放器源码免费下载 依赖composer php 5.6+ ... rewrite ^/(.*)$ /index.php?s=$1 last; break; } } 视频安装教程:https://www.bilibili.com/video/av46476706
-e $request_filename) { rewrite ^/(.*)$ /index.php?s=$1 last; break; } } apache 项目自带apache静态化无需配置 启动项目 添加public为web根目录 若为apache服务器则默认伪静态,nginx可自行配置伪静态
apache的环境,确保站点根目录有.htaccess文件即可。不需要额外配置b.IIS 环境, 在站点根目录有一个 iis文件夹,里面是iis的重新规则。 需要手工配置,具体如何配置请咨询空间提供商,每家可能有所不同。c. nginx...
web.Config文件放到index.php的同级目录或在中间添加rewrite节点 [ Nginx ] 将web.conf里面的代码复制到你的网站配置的 location /{.....}中间 重启nginx即可 2、网站后台》系统》URL优化:开启重写功能。 ...
<action type="Rewrite" url="index.php/{R:1}" /> </rewrite> [nginx] 在Nginx低版本中,是不支持PATHINFO的,但是可以通过在Nginx.conf中配置转发规则实现: location / { if (!-e $request_filename)...
3.使用说明中增加了nginx,iis,apache的rewrite规则 4.在电影播放页面的模板p.html中 可以使用 {$playname} 作为电影名称进行SEO 5.在电影介绍页面的模板m.html中 可以使用 {$gettitle} 作为电影名称 进行SEO 6.从...
然后将main-back.php文件名修改为main.php文件,替换原来的main.php文件 5.使用页面JS代码实现的跳转效率较低,需要的时间更长,故默认不使用JS代码来实现跳转 6.移动版的Google搜索失效,这是Glype程序本身与...
适用环境1 支持CURL采集演示站 //wenda.hxcq.info使用限制无后台前台模板页面utf-8程序简介data/ 数据缓存目录data/compile 模板编译目录config.php 配置文件index.php 主文件........以下是APACHE REWRITE 规则,...
httpd.conf配置文件中加载了mod_rewrite.so模块 AllowOverride None 将None改为 All 把下面的内容保存为.htaccess文件放到应用入口文件的同级目录下 RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-...
Apache通常设置为index.php或index.html 。 在.htaccess文件中设置DirectoryIndex设置是一个好习惯,特别是如果您在共享主机上托管网站。 托管服务提供商的准则可能随时更改,但您的.htaccess文件指令将为您避免...
一 打开 Apache 的配置文件 httpd.conf 。 二 将#LoadModule rewrite_module modules/mod_rewrite前面的#去掉 三 在 httpd.conf中添加: <IfModule> RewriteEngine On #RewriteCond %{ENV:SCRIPT_URL} (?:index|...
SAPI 是微信小程序、公众号SaaS运营平台,基于ThinkPHP EasyWecaht。集成同城锁客宝、城市号、售后宝、点餐宝、商城等微信小程序、公众号...rewrite ^(.*)$ /index.php?s=$1 last; } } 8、框架安装完成,开始安装应用
PHP-For-Go-Web 是用 php bootstrap3 来解析《Go Web 编程》的 md 文件。构建本地或者远程网站。妈妈再也不用担心我的... rewrite ^/goweb/(.*)$ /goweb/index.php?file=$1 last; } } 标签:PHPForGoWeb