代码之家  ›  专栏  ›  技术社区  ›  Ivo Sabev

CodeIgniter 2.0友好URL不适用于Mac OS X Snow Leopard

  •  1
  • Ivo Sabev  · 技术社区  · 15 年前

    由于某些原因,ci2.0中的url不起作用。

    http://localhost/myapp/ - will open the default controller (bc it finds index.php)
    http://localhost/myapp/index.php/home/ - will open the default controller 
    http://localhost/myapp/home/ - will show path not found
    

    我不确定这是2.0的问题还是我的配置的特定问题。

    6 回复  |  直到 14 年前
        1
  •  4
  •   Ken Struys    15 年前

    在apache中有这样的重写规则来处理codeigniter吗?请参见: http://codeigniter.com/wiki/mod_rewrite/

    • 一秒钟就行了,因为你把它传给索引.php
    • 第三个习惯没有重写规则。
        2
  •  3
  •   Ivo Sabev    15 年前

    很棘手。谢谢大家。否则,你所需要的只是常规的.htaccess,正如人们已经指出的那样。

        3
  •  1
  •   Sean Vieira    15 年前

    .htaccess .htaccess访问

    (建议的配置来自 CodeIgniter manual 因此应该可以正常工作。)

        4
  •  0
  •   workdreamer Stefan Gehrig    14 年前
    $ sudo sudo chgrp staff /Library/WebServer/Documents/
    $ sudo chmod 775 /Library/WebServer/Documents/
    

    之后,我的所有应用程序都将位于文件夹/Library/WebServer/Documents下/

    /库/Web服务器/文档/测试

    $ echo "Hello World" >> /Library/WebServer/Documents/testing/index.php
    http://localhost/testing 
    ==> it should appear Hello World
    

    现在,您将在文件夹“/Library/WebServer/Documents/”下放置CI文件夹 您必须添加

    .htaccess 
    
    RewriteEngine On
    RewriteCond $1 !^(index\.php)
    RewriteRule ^(.+)$ index.php?$1 [L]
    AddHandler php5-script .php
    

    $config['index_page'] = '';
    

    我想就这些!好好享受!

        5
  •  0
  •   volter9    12 年前

    here 就在“移除索引.php文件的头。

    默认情况下索引.php文件将包含在您的URL中:

    example.com/索引.php/news/article/my\u可以轻松删除的文章 通过使用带有一些简单规则的.htaccess文件创建此文件。这是一个 这样一个文件的例子,使用“negative”方法,其中 除指定的项目外,所有内容都被重定向:

    RewriteEngine on
    RewriteCond $1 !^(index\.php|images|robots\.txt)
    RewriteRule ^(.*)$ /index.php/$1 [L]
    

    在上面的示例中,除了索引.php, 文件。

        6
  •  0
  •   Caio Leonhardt    11 年前

    最好的方法是安装XAMPP,和我一起工作。

    只需停止本地apache并将应用程序放在htdocs(XAMPP)中。

    祝你好运

    推荐文章