【问题标题】:Codeigniter .htaccess not getting writeCodeigniter .htaccess 没有被写入
【发布时间】:2013-10-25 20:23:25
【问题描述】:
<IfModule mod_rewrite.c>
# Checks to see if the user is attempting to access a valid file,
# such as an image or css document, if this isn't true it sends the
# request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ main.php/$1 [L]
</IfModule>

这是我的 .htaccess ,但我没有得到正确的链接

每当我点击没有 index.php 的链接时,它都会重定向到 wamp 服务器主页

【问题讨论】:

  • 你必须解释你的问题比这更好。怎么了?发生了什么出乎您的意料?

标签: .htaccess codeigniter url


【解决方案1】:

试试这个:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    RewriteCond %{REQUEST_URI} ^sys.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_URI} ^app.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

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

假设 index.php 是您的索引页面。

并更改 config.php

$config['index_page'] = '';

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-09-10
    • 2017-02-17
    • 2012-06-04
    • 2011-04-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多