我一直在XAMPP中使用CodeIgniter.重定向到功能URL没有问题(例如,function1):
http://localhost/function1
Run Code Online (Sandbox Code Playgroud)
当我改为WAMP时,我遇到了问题.我无法重定向到function1.但是,仍然可以在以下位置访问function1:
http://localhost/index.php/function1
Run Code Online (Sandbox Code Playgroud)
如何配置WAMP和CodeIgniter来删除index.php?为了在运行XAMPP时可以运行function1.
谢谢.
Man*_*nju 10
请尝试以下方法:
1)与应用程序文件夹并行创建.htaccess文件,只需复制粘贴以下代码:
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]
Run Code Online (Sandbox Code Playgroud)
2)在应用程序文件夹中更改$config['index_page']为空白,config.php如下所示:
$config['index_page'] = '';
Run Code Online (Sandbox Code Playgroud)
3)启用rewrite_moduleapache的" ".单击WAMP符号 - > Apache - > Apache模块 - > rewrite_module
现在,您可以在url中访问没有index.php的站点.