分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 网页技术

Yii优化路由Apache配置(在APACHE服务器上的访问方式上去除index.php)

发布时间:2023-09-06 02:06责任编辑:顾先生关键词:配置
在APACHE服务器上的访问方式上去除index.php
 

下面我说下 apache 下 ,如何 去掉URL 里面的 index.php 
例如: 你原来的路径是: localhost/index.php/index 
改变后的路径是: localhost/index 

1.httpd.conf配置文件中加载了mod_rewrite.so模块 //在APACHE里面去配置 
#LoadModule rewrite_module modules/mod_rewrite.so把前面的警号去掉 

2.httpd.conf配置文件中 ,将里面的AllowOverride None都改为AllowOverride All

注意:修改之后一定要重启apache服务。

2 .添加.htaccess文件放到index.php同级目录下(入口文件)

Options+FollowSymLinksIndexIgnore */*RewriteEngine on# if a directory or a file exists, use it directlyRewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-d# otherwise forward it to index.phpRewriteRule . index.php

3.去配置文件web.php中

把下面这段的注释解开

 ???????/* ???????‘urlManager‘ => [ ???????????‘enablePrettyUrl‘ => true, ???????????‘showScriptName‘ => false, ???????????‘rules‘ => [ ???????????], ???????], ???????*/

Yii优化路由Apache配置(在APACHE服务器上的访问方式上去除index.php)

原文地址:https://www.cnblogs.com/baobaoa/p/9375523.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved