【发布时间】:2013-05-02 11:06:48
【问题描述】:
我有一个带有一个控制器的 codeigniter 应用程序 (main.php)
目前,我已将 htaccess 文件设置为删除 index.php 和 main.php
所以不是 www.domain.com/index.php/main/function_name,而是 www.domain.com/function_name
我的 htaccess 文件如下所示:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/main/$1 [L]
ErrorDocument 404 /index.php
我现在需要向网站添加一大块。它目前内置在一个单独的 codeigniter 应用程序中,我需要将它移过来。该站点的新部分位于 controllers/manage_emails/contacts.php...
我的问题是,在大多数情况下,我如何更改 htaccess 文件以从 URL 中删除 main.php,但是如果您输入 www.domain.com/manage_emails/contollername,它将转到正确的位置控制器。
谢谢!
【问题讨论】:
标签: php apache .htaccess codeigniter