使用URL重写,去掉index.php
2011-12-19 10:05
405 查看
1、在httpd.conf中打开apache的rewrite模块
#LoadModule rewrite_module modules/mod_rewrite.so
将前面的“#”去掉
将“AllowOverride None”改为“AllowOverride All”
2、在你的app根目录下创建.htaccess内容如下:
<IfModule mod_rewrite.c>
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
</IfModule>
3、修改config/main.php,在刚才UrlManager组件增加属性showScriptName,值为false.
'urlManager'=>array(
'urlFormat'=>'path', //使用pathinfo模式
'showScriptName'=>false,//不显示脚本名
),
4、重启apache
#LoadModule rewrite_module modules/mod_rewrite.so
将前面的“#”去掉
将“AllowOverride None”改为“AllowOverride All”
2、在你的app根目录下创建.htaccess内容如下:
<IfModule mod_rewrite.c>
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
</IfModule>
3、修改config/main.php,在刚才UrlManager组件增加属性showScriptName,值为false.
'urlManager'=>array(
'urlFormat'=>'path', //使用pathinfo模式
'showScriptName'=>false,//不显示脚本名
),
4、重启apache
相关文章推荐
- codeigniter的url重写问题(去掉index.php路由)
- yii2 如何使用 PATH_INFO 模式 并去掉 index.php
- Yii+Apache url重写去掉index.php
- codeigniter的url重写问题(去掉index.php路由)
- MVC中去掉index.php(优雅的使用url)
- yii url重写去掉index.php
- ci中的url重写,去掉index.php
- CodeIgniter 的url中去掉index.php
- 如何去掉Magento默认URL中的index.php
- Magento 去掉URL地址中的index.php字符串[ubuntu]
- CI 中index.php去掉的方法 (可用可不用) wamp环境下
- CI去掉 URL 中的 index.php
- PHP CodeIgniter(CI)框架中去掉 index.php方法
- magento 去掉index.php .html
- ThinkPHP去掉URL中的index.php
- thinkphp iis下去掉index.php
- 如何去掉CodeIgniter中URL里的index.php
- dedecms判断使用方面 [field:global runphp='yes' name=autoindex]
- php使用 _before_index() 来实现访问页面前,判断登录
- 如何去掉Magento默认URL中的index.php