CodeIgniter:删除“index.php”在WAMP上的网址 [英] CodeIgniter: Removing "index.php" in URL on WAMP
问题描述
在CodeIgniter中,我想删除URL中的index.php,在我的localhost(WAMP)。例如, http://localhost.com/ci/index.php/controller/function 至 http://localhost.com/ci/controller/function
我更改了
$ config ['index_page'] ='index.php '; to $ config ['index_page'] ='';
我的.htaccess文件(位于根目录,index.php所在的位置)是如下:
< IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase / igniter
#Removes用户访问系统文件夹。
#另外,这将允许您创建一个System.php控制器,
#previously这是不可能的。
#'system'可以替换,如果你已经重命名您的系统文件夹。
RewriteCond%{REQUEST_URI} ^ system。*
RewriteRule ^(。*)$ /index.php/$1 [L]
#检查用户是否尝试访问一个有效的文件
#s如一个图像或CSS文档,如果这不是真的,它发送
#request到index.php
RewriteCond%{REQUEST_FILENAME}!-f
RewriteCond%{REQUEST_FILENAME}!-d
#最后一个条件允许访问图像和css文件夹以及robots.txt文件
#由Michael Radlmaier提交(mradlmaier)
RewriteCond $ 1!^(index\.php | images | robots\.txt | css)
RewriteRule ^(。*)$ index.php / $ 1 [L]
< / IfModule>
< IfModule!mod_rewrite.c>
#如果我们没有安装mod_rewrite,所有404的
#都可以发送到index.php,一切正常。
#提交者:ElliotHaughin
ErrorDocument 404 /index.php
< / IfModule>
我也进入httpd.conf文件,取消注释 LoadModule rewrite_module modules / mod_rewrite.so
最后,httpd.conf文件中的目录部分如下所示。
< Directory />
选项FollowSymLinks
AllowOverride所有
订单拒绝,允许
拒绝所有
< / Directory>
我还是无法得到它的工作..页面读取:请求的URL /在此服务器上找不到db / site。
任何帮助都将非常感谢!
尝试:
RewriteBase /
/ pre>
要更改目录
In CodeIgniter, I want to remove the "index.php" in the URL, on my localhost (WAMP). For example, http://localhost.com/ci/index.php/controller/function to http://localhost.com/ci/controller/function
I have changed
$config['index_page'] = 'index.php'; to $config['index_page'] = '';
My .htaccess file (which is located in the root directory, where the index.php lies) is as follows:
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase /igniter #Removes access to the system folder by users. #Additionally this will allow you to create a System.php controller, #previously this would not have been possible. #‘system’ can be replaced if you have renamed your system folder. RewriteCond %{REQUEST_URI} ^system.* RewriteRule ^(.*)$ /index.php/$1 [L] #Checks to see if the user is attempting to access a valid file, #such as an image or css document, if this isn’t true it sends the #request to index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d #This last condition enables access to the images and css folders, and the robots.txt file #Submitted by Michael Radlmaier (mradlmaier) RewriteCond $1 !^(index\.php|images|robots\.txt|css) RewriteRule ^(.*)$ index.php/$1 [L] </IfModule> <IfModule !mod_rewrite.c> # If we don’t have mod_rewrite installed, all 404’s # can be sent to index.php, and everything works as normal. # Submitted by: ElliotHaughin ErrorDocument 404 /index.php </IfModule>
I have also gone into httpd.conf file and uncommented
LoadModule rewrite_module modules/mod_rewrite.so
And finally the directory section in the httpd.conf file looks like this..
<Directory /> Options FollowSymLinks AllowOverride All Order deny,allow Deny from all </Directory>
And I still can't get it to work.. The page reads: "The requested URL /db/site was not found on this server."
Any help would be much appreciated, thanks!
解决方案Try:
RewriteBase /
To change the directory
这篇关于CodeIgniter:删除“index.php”在WAMP上的网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!