【问题标题】:url not working with browser other than chrome, htaccess file errorurl不适用于chrome以外的浏览器,htaccess文件错误
【发布时间】:2015-01-29 14:04:55
【问题描述】:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond $1 !^(index\.php|js|css|images|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]

当我在 Chrome 中访问 localhost/myProject/home 时,我已经编写了这个 .htaccess 文件,这工作正常,但在其他浏览器中它显示页面未找到错误

【问题讨论】:

    标签: .htaccess codeigniter firefox


    【解决方案1】:

    您很可能需要Options +FollowSymLinks。对于 codeigniter 的更多 htaccess,请单击链接并在 David Connelly 的网站上下载 zip。他们有大约 5 种不同的拉链,你可以尝试,毫无疑问,其中一种会起作用。 http://www.insiderclub.org/downloads

    我在下面使用的那个在所有用于 codeigniter 的浏览器中都可以正常工作。确保在使用此或任何其他 htaccess 时,将域放在 config/config.php 的基本 url 中,然后从 config/config.php 中删除 index.php

    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]
    

    【讨论】:

    • 你的 routes.php 说什么?
    • 问题是,当我尝试通过 localhost/project/index.php/home 在 Firefox 中访问它时,它工作正常。但在使用 localhost/project/home 时不起作用
    • 我还没有对 route.php 文件进行任何更改
    • 你有没有下载 htacess zip 并尝试过。您是否从 config.php 文件中删除了 index.php。
    • 在你的路由中你需要设置一个默认控制器。 $route['default_controller'] = 'folder/controller'; 然后你可以添加其他路由。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-15
    • 1970-01-01
    • 2013-06-29
    • 2023-03-24
    相关资源
    最近更新 更多