如何清除index.php在Wamp? [英] How to remove index.php in Wamp?
问题描述
我在XAMPP中一直使用CodeIgniter。
重定向到函数网址没有问题(例如 function1 ):
http:// localhost / function1
当我改用WAMP时,我无法重定向到 function1 。不过, function1 仍然可以在以下位置访问:
http://localhost/index.php/function1
如何配置WAMP和CodeIgniter删除index.php?
为了在使用XAMPP运行时能够运行 function1 。
谢谢。
请尝试以下操作: p>
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 ['index_page']
更改为空 config.php
在应用程序文件夹中:
$ config [ 'index_page'] ='';
3)启用 rewrite_module
现在,您可以访问您的网站,无需在网址中使用index.php。
I 've been using CodeIgniter in XAMPP. There was no problem to redirect to a function URL (e.g., function1):
http://localhost/function1
When I changed to WAMP, I got a problem. I could not redirect to function1. However, function1 is still accessed at:
http://localhost/index.php/function1
How to configure WAMP and CodeIgniter to remove index.php? In order that I could run function1 as I run using XAMPP.
Thank you.
Please try the following:
1) Create .htacess file in parallel to application holder and just copy past the following code:
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) Change $config['index_page']
to blank in config.php
in application folder as below:
$config['index_page'] = '';
3) Enable "rewrite_module
" of apache.
Now you can access your site without index.php in url.
这篇关于如何清除index.php在Wamp?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!