0
<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 服务器主页

4

1 回答 1

0

尝试这个:

<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'] = '';
于 2014-01-15T05:52:56.460 回答