【问题标题】:Removing index.php from Codeigniter on OS X 10.9.4在 OS X 10.9.4 上从 Codeigniter 中删除 index.php
【发布时间】:2014-10-01 08:27:17
【问题描述】:

我正在尝试在新 Mac 上设置本地开发环境。这是我的第一个,我不太确定不同的东西。

我已经正确设置了大部分内容,现在我可以像这样访问我的网站:

localhost/~carlo/website.com/

对于 Codeigniter,我必须将 index.php 放在最后。

我平时使用的.htaccess是这样的:

RewriteEngine on
RewriteBase /~carlo/website.com/


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond $1 !^(index\.php|cache|captcha|fonts|forum|media|img|min|css|js|scripts|images|uploads|docs|robots.       txt|sitemap.xml|sitemap|public|tools|wpblog|assets|xd_receiver.htm)

RewriteRule ^(.*)$ index.php/$1 [L]

但这还不够。

我将此添加到 /private/etc/apache2/extra/httpd-vhosts.conf:

DocumentRoot "/Users/carlo/public_html" ServerName "localhost" ErrorLog "/private/var/log/apache2/dummy-host.example.com-error_log" CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log" common

DocumentRoot "/Users/carlo/public_html/website.com" ServerName tobecontinuedcomic.com AllowOverride All Options +FollowSymLinks Order allow,deny Allow from All

但还是一无所获。有什么帮助吗?

【问题讨论】:

    标签: php macos apache .htaccess codeigniter


    【解决方案1】:

    看起来RewriteCond 不正确 - 我猜你需要这个:

    RewriteCond %{REQUEST_URI} !^(index\.php|cache|captcha|fonts|forum|media|img|min|css|js|scripts|images|uploads|docs|robots.txt|sitemap.xml|sitemap|public|tools|wpblog|assets|xd_receiver.htm)
    RewriteRule ^(.*)$ index.php/$1 [L]
    

    【讨论】:

    • 不,这并没有解决问题。查看 apache 日志我收到此错误: Options FollowSymLinks or SymLinksIfOwnerMatch is off 这意味着 RewriteRule 指令被禁止:
    猜你喜欢
    • 2014-09-20
    • 1970-01-01
    • 1970-01-01
    • 2014-11-07
    • 2016-05-14
    • 2014-10-28
    • 2012-06-15
    • 2013-02-27
    • 2012-09-21
    相关资源
    最近更新 更多