【问题标题】:Codeigniter Htaccess didn't work on win 64-bitCodeigniter Htaccess 在 win 64 位上不起作用
【发布时间】:2017-08-27 20:27:50
【问题描述】:

将我的目录移动到 64 位 Windows 时,在我的 Windows 32 位 XAMPP 中工作的 .htaccess 文件不起作用。

此 URL 在我的 32 位窗口中有效,但不适用于我得到“找不到对象”的 64 位设置:

localhost/folder/controller

但是这个网址确实有效:

localhost/folder/index.php/controller

这是我的 .htaccess 文件:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php?/$0 [PT,L]

【问题讨论】:

    标签: php apache .htaccess codeigniter


    【解决方案1】:

    我在 Windows 10 和 XAMPP 上使用它。

    htdocs > yourprojectname > .htaccess

    Options +FollowSymLinks
    Options -Indexes
    DirectoryIndex index.php
    RewriteEngine on
    RewriteCond $1 !^(index\.php|images|robots\.txt)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L,QSA]
    

    你也可以从这里尝试更多的 htaccess

    https://github.com/wolfgang1983/htaccess_for_codeigniter

    htdocs > yourprojectname > 应用程序 > config.php

    // Must set your base_url in config.php
    $config['base_url'] = 'http://localhost/yourprojectname/';
    $config['index_page'] = '';
    

    【讨论】:

    • 在我的机器上还是不行,你用的是32位还是64位?
    • @kai1313 您的文件命名正确吗?示例:Welcome.php 然后class Welcome extends CI_Controller {} 其中只有第一个字母大写
    • 我确定我这样做了,因为它在我的 32 位设备和主机中运行良好
    【解决方案2】:

    请在 .htaccess 中将 .htaccess 添加到 codeigniter 的根目录,只需添加这个 .. 就可以了。 **

    DirectoryIndex index.php
    RewriteEngine on
    RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ ./index.php?/$1 [L,QSA]
    

    **

    【讨论】:

    • 仍然无法在打开 htaccess 时工作,htdocs/folder/ 是否赢得 64 位需要不同于 32 位的东西?因为我的设置和一切都在我的 32 位设备上运行良好
    • 您使用的是 64 位 xampp?目前还没有适用于 Windows 的 64 位版本。请在 C 盘(默认路径)上安装 32 位 xampp,一切顺利。
    • 我正在使用我在 32 位设备上使用的相同安装程序,并将其放在 C 上(默认路径)
    猜你喜欢
    • 1970-01-01
    • 2013-06-22
    • 2013-09-21
    • 1970-01-01
    • 2014-12-23
    • 1970-01-01
    • 2021-09-03
    • 1970-01-01
    相关资源
    最近更新 更多