如何从url cakephp中删除index.php [英] how to remove index.php from url cakephp
问题描述
我在Cakephp 2.3上构建了一个webapp ..我的locaLhost所有的URL都很好..我可以访问我的URL像这样
i have build a webapp on Cakephp 2.3 .. on my locaLhost all urls were fine.. i can access my urls like this
http://localhost/Cakephp
但是现在当我在服务器上根文件夹...我不能访问我的URL像这样
but now when i have uploaded the site on server in root folder ... i cant access my url like this
http://www.myweb.com
而不是像这样可以访问
http://www.myweb.com/index.php/login
what i认为可能是一个问题是我的应用程序/ webroot文件夹中的.htaccess文件
what i think that might be a problem is the .htaccess file in my app/webroot folder
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
我认为这种index.php导致的问题..我不知道.htaccess所以不知道如何删除它。
I think this kind of index.php is causing the problem ..as i dont know about .htaccess so dont know how to remove it.
如何从我的urls中获取index.php?
How do I get index.php out of my urls?
推荐答案
检查 mod_rewrite
模块是否已安装?如果不是在 httpd.conf
文件中友好地启用它。
Check the mod_rewrite
module is installed or not? if not kindly enable it in httpd.conf
file.
查找以下行并删除#
(表示取消注释)。
Find the following line and remove #
(means uncomment) in front of it.
LoadModule rewrite_module modules/mod_rewrite.so
也不要忘记使用以下命令重新启动apache http服务:
Also don't forget to restart apache http service using following command:
service httpd restart
从CPanel编辑http.conf文件的步骤:
Following are the steps to edit http.conf file from CPanel:
- 以root用户身份登录到WHM / cPanel。
- 打开服务配置部分。
- 打开Apache配置部分。
- 进行所需的更改,然后单击保存按钮。通过cPanel显示httpd.conf的设置。这会保存更改,然后重新启动Apache以便应用更改。
- Log in to WHM/cPanel as the root user.
- Open the "Service Configuration" section.
- Open the "Apache Configuration" section.
- Click "Global Configuration" to access the httpd.conf's settings, as displayed through cPanel.
- Make your desired changes, then click the "Save" button. This saves the changes and then reboots Apache so that the changes are applied.
阅读更多: http://www.ehow.com/how_8696084_edit-httpdconf-cpanel.html#ixzz2YRDEgOMT
在IIS服务器阅读此链接以启用mod_rewrite
这篇关于如何从url cakephp中删除index.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!