How to remove ci's index.php
去掉ci的index.php的方法:首先打开apache的配置文件;然后将相关htaccess的相关信息改为“AllowOverride All”;接着在CI的根目录下,建立htaccess;最后重启apache即可。
推荐:《PHP视频教程》
去掉CodeIgniter(CI)默认url中的index.php的步骤:
1.打开apache的配置文件,conf/httpd.conf :
LoadModule rewrite_module modules/mod_rewrite.so
把该行前的#去掉。
搜索 AllowOverride None(配置文件中有多处),看注释信息,将相关.htaccess的该行信息改为:
AllowOverride All
2.在CI的根目录下,即在index.php,system的同级目录下,建立.htaccess,直接建立该文件名的不会成功,可以先建立记事本文件,另存为该名的文件即可。内容如下(CI手册上也有介绍):
RewriteEngine on RewriteCond $1 !^(index\.php|images|robots\.txt) RewriteRule ^(.*)$ /index.php/$1 [L]
如果文件不是在www的根目录下,例如我的是:
http: //localhost/ci_demo_1/index.php/
第三行需要改写为
RewriteRule ^(.*)$ /CI/index.php/$1 [L]
另外,我的index.php的同级目录下还有assets文件夹,这些需要过滤除去,第二行需要改写为:
RewriteCond $1 !^(index\.php|images|assets|robots\.txt
3.将CI中配置文件(application/config/config.php)中
$config[ 'index_page' ] = "index.php" ;
改成
$config[ 'index_page' ] = "" ;
重启apache,完成。
=========================================================================================================================
php 框架ci去index.php的方法
网上有很多方法都要引入.htaccess文件,如果是在测试环境下,动态和静态的文件放到一块,可能测试会有一定的问题(由于全部定向到index.php),静态网页访问不了。
这里提供一种方法,只需要修改http.conf文件,
步骤:
1 :在配置虚拟目录下加入
<Directory /> Options Indexes FollowSymLinks AllowOverride all Order allow,deny Allow from all </Directory> <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^/script/(.*) /script/$1 [L] RewriteRule ^(.*)$ /index.php?/$1 [L] </IfModule>
2 将下面这行前面的;去掉
LoadModule rewrite_module modules/mod_rewrite.so
3 重启apache就可以了,无需加入.htaccess文件
The above is the detailed content of How to remove ci's index.php. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



With the continuous development and upgrading of website construction, choosing a framework that suits you has become an essential skill for website builders. This article will briefly analyze CI and Laravel to help you choose a framework that is more suitable for building a blog or CMS website. 1. Introduction to CI CodeIgniter, referred to as CI, is an open source lightweight web application development framework that adopts the MVC architecture model. CI can run on PHP5.2 and above, and includes many commonly used libraries and helper functions, making it possible to use CI to develop web applications.

With the rapid development of the Internet, the application of PHP language is becoming more and more widespread. In order to improve development efficiency, reduce development costs and adopt best practices, the PHP framework came into being. Among them, CodeIgniter (CI) and Yii are two well-known PHP frameworks. This article will explore these two frameworks from the perspective of innovation capabilities. CodeIgniter (CI) is a lightweight PHP framework that is widely used for rapid development of web applications. The main features of CI are ease of use, speed and flexibility. exist

How to remove index.php from the server: 1. Open the php.ini file and change the content to "cgi.fix_pathinfo=1"; 2. Modify the configuration file of the corresponding virtual host; 3. Change "include enable-php.conf;" Replace with "include enable-php-pathinfo.conf;"; 4. Remove index.php and restart lnmp.

How to hide index.php in tp3: 1. Find and open the "Application/Common/Conf/config.php" file; 2. Turn on REWRITE mode by modifying "return array('URL_MODEL'=> 2,);".

The string index.php often appears in the URLs of many websites. Although this file is very important, sometimes users want to remove this string from their URLs to make the website structure clearer.

How to hide index.php in lnmp: 1. Open the "location ~ [^/].php" file; 2. Modify the content to "location ~ [^/].php"; 3. Remove "#try_files $uri =404; The # symbol in front of "; 4. Add the content "rewrite "^/(.*)$" /index.php last;"; 5. Restart Nginx.

Answer: Using continuous integration (CI) combined with C++ function unit testing can automate code testing and ensure code quality and reliability. Install CMake and the unit test framework: GoogleTest: sudoaptinstalllibgtest-devCatch2: sudoaptinstalllibcatch2-dev Write unit tests: Write code tests using a unit test framework such as GoogleTest Configure CMake: Add unit tests in CMakeLists.txt Run tests in CI: Configure CI Systems (like Jenkins) run tests on every push

Introduction In software development, continuous integration and continuous delivery (CI/CD) are important practices to improve development and deployment efficiency. It automates the code construction, testing and deployment process to ensure the quality and stability of the code and shorten the cycle from development to delivery. This article will introduce how to use tools such as jenkins, Docker and kubernetes to establish a CI/CD process suitable for PHP projects. CI/CD process The CI/CD process generally includes the following stages: Continuous integration (CI): After the code is submitted to the code base, the code is built and tested. Continuous Delivery (CD): If tests pass, code is deployed to staging or production. Monitoring and feedback: Monitor the health of the system after deployment and collect user feedback.
