Home  >  Article  >  Backend Development  >  Solve CodeIgniter pseudo-static failure_PHP tutorial

Solve CodeIgniter pseudo-static failure_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:28:41790browse

Original address: http://127.0.0.1/onsite/index.php/welcome/index/abc123

Modified address: http://127.0.0.1/onsite/abc123.html

Copy code The code is as follows:


RewriteEngine on
RewriteBase /onsite

RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ (.*).html$ index.php/welcome/index/$1 [L]

The rules are correct, but I never expected that CodeIgniter reported 404 page not found; after testing, creating an html file with the same name in the root directory can be displayed normally;

The problem should be caused by the CI configuration; after some twists and turns, I found a parameter:

Copy code The code is as follows:

$config['uri_protocol'] = 'AUTO';

Change it to:

Copy code The code is as follows:

$config['uri_protocol'] = 'PATH_INFO';

The page finally displays normally;

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/781027.htmlTechArticleOriginal address: http://127.0.0.1/onsite/index.php/welcome/index/abc123 After modification Address: http://127.0.0.1/onsite/abc123.html Copy the code as follows: IfModule mod_rewrite.c Rewrit...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn