Php 允许在代码点火器中更改URI
我对CodeIgniter相当陌生,我所有的链接都有this path“/文件夹/文件”。所以我希望当我调用链接时,它应该显示:Php 允许在代码点火器中更改URI,php,html,codeigniter,hyperlink,Php,Html,Codeigniter,Hyperlink,我对CodeIgniter相当陌生,我所有的链接都有this path“/文件夹/文件”。所以我希望当我调用链接时,它应该显示: www.website.com/folder/file 但当我点击它时,它会变成这样: www.website.com/index.php/folder/file 我如何防止它发生?我希望它也是相对的 是否需要触摸配置中的某些内容?如果要从url中删除index.php,只需执行以下步骤: 1) 与应用程序持有者并行创建.htacess文件 只需复制以下代码: R
www.website.com/folder/file
但当我点击它时,它会变成这样:
www.website.com/index.php/folder/file
我如何防止它发生?我希望它也是相对的
是否需要触摸配置中的某些内容?如果要从url中删除index.php,只需执行以下步骤: 1) 与应用程序持有者并行创建.htacess文件 只需复制以下代码:
RewriteEngine On
RewriteBase /CodeIgniter/
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
2) 在应用程序文件夹的config.php中将$config['index_page']更改为空,如下所示:
$config['index_page'] = '';
3) 启用apache的“重写\u模块”
我的详细博客:如果您使用IIS,则需要在根目录中创建一个名为web.config的文件,并粘贴以下内容
检查此项
关于config.php
$config['index_page'] = 'index.php';
关于.htaccess
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
是否要从url中删除index.php?
RewriteBase/CodeIgniter/
哪个版本?
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d