简体   繁体   English

如何从Bitnami MAMP堆栈上的Codeigniter中删除index.php

[英]How to remove index.php from codeigniter on Bitnami MAMP stack

I have been developing using Bitnami MAMP stack 5.6.19 on my Macbook 我一直在Macbook上使用Bitnami MAMP堆栈5.6.19进行开发

I'm now ready to upload it to my server, but before that I want to remove the index.php from the site url and test it on my Mac so I can address any bugs. 我现在准备将其上传到服务器,但是在此之前,我想从站点URL中删除index.php并在Mac上对其进行测试,以便解决所有错误。

I have tried changing the httpd-app.conf, httpd-prefix.conf as suggested on the Bitnami site, but no luck. 我曾尝试根据Bitnami网站上的建议更改httpd-app.conf,httpd-prefix.conf,但没有运气。 I get a 404 error from the page. 我从页面收到404错误。

Here is the httpd-app.conf 这是httpd-app.conf

I change AllowOverrite from None to All 我将AllowOverriteNone更改为All

<Directory "/Applications/mampstack-5.6.19-0/frameworks/codeigniter/htdocs">
Options +MultiViews
AllowOverride All
<IfVersion < 2.3 >
    Order allow,deny
    Allow from all
</IfVersion>
<IfVersion >= 2.3>
    Require all granted
</IfVersion>

<IfDefine USE_PHP_FPM>
   <FilesMatch \.php$>
     SetHandler "proxy:fcgi://codeigniter-fpm"
   </FilesMatch>
</IfDefine>

</Directory>

Here is the httpd-prefix.conf 这是httpd-prefix.conf

I added DocumentRoot "/Applications/mampstack-5.6.19-0/frameworks/codeigniter/htdocs" and commented out the Alias's 我添加了DocumentRoot "/Applications/mampstack-5.6.19-0/frameworks/codeigniter/htdocs"并注释掉了Alias's

DocumentRoot "/Applications/mampstack-5.6.19-0/frameworks/codeigniter/htdocs"
#Alias /codeigniter/ "/Applications/mampstack-5.6.19-0/frameworks/codeigniter/htdocs/"
#Alias /codeigniter "/Applications/mampstack-5.6.19-0/frameworks/codeigniter/htdocs"

Include "/Applications/mampstack-5.6.19-0/frameworks/codeigniter/conf/httpd-app.conf"

In the codeigniter config I changed $config['index_page'] = 'index.php'; 在codeigniter配置中,我更改了$config['index_page'] = 'index.php'; to $config['index_page'] = ''; $config['index_page'] = '';

I can't edit that the .htaccess file, cause I can't locate it and from what I understand Bitnami changed the app so you don't need to change .htaccess 我无法编辑.htaccess文件,因为无法找到它,并且据我了解,Bitnami更改了该应用程序,因此您无需更改.htaccess

使用http://www.your-site.com代替index.php ,当然,用您的网站名称替换your-site

Add a .htaccess file in root folder and paste this code into it. 在根文件夹中添加.htaccess文件,并将此代码粘贴到其中。

htaccess Module: htaccess模块​​:

<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php/$1 [QSA,L] </IfModule>

Regards :) 问候 :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM