dongxi2014 2017-02-07 12:40
浏览 72
已采纳

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

I have been developing using Bitnami MAMP stack 5.6.19 on my Macbook

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.

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.

Here is the httpd-app.conf

I change AllowOverrite from None to 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

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 /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'; to $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

  • 写回答

2条回答 默认 最新

  • douzai8285 2017-02-08 10:06
    关注

    Add a .htaccess file in root folder and paste this code into it.

    htaccess Module:

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

    Regards :)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?