问题描述
我一直在Macbook上使用Bitnami MAMP堆栈5.6.19进行开发
I have been developing using Bitnami MAMP stack 5.6.19 on my Macbook
我现在准备将其上载到服务器,但是在此之前,我想从站点URL中删除index.php并在Mac上对其进行测试,以便解决所有错误.
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.
我尝试按照Bitnami网站上的建议更改httpd-app.conf,httpd-prefix.conf,但没有运气.我从页面收到404错误.
I have tried changing the httpd-app.conf, httpd-prefix.conf as suggested on the Bitnami site, but no luck. I get a 404 error from the page.
这是 httpd-app.conf
我将AllowOverrite
从None
更改为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>
这是 httpd-prefix.conf
我添加了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"
在codeigniter配置中,我将$config['index_page'] = 'index.php';
更改为$config['index_page'] = '';
In the codeigniter config I changed $config['index_page'] = 'index.php';
to $config['index_page'] = '';
我无法编辑 .htaccess 文件,因为找不到该文件,据我了解,Bitnami更改了该应用程序,因此您无需更改 .htaccess
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文件,并将此代码粘贴到其中.
Add a .htaccess file in root folder and paste this code into it.
htaccess模块:
htaccess Module:
<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php/$1 [QSA,L] </IfModule>
此致:)
这篇关于如何从Bitnami MAMP堆栈上的Codeigniter中删除index.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!