【问题标题】:codeigniter htaccess with multiple applications带有多个应用程序的codeigniter htaccess
【发布时间】:2012-08-23 00:22:04
【问题描述】:

我正在使用 codeigniter。我有前端应用程序和后端应用程序,例如

/系统/

/应用程序/

   /front/

   /admin/

index.php

admin.php

.htaccess

我想要我的网址,例如 http://example.com/news/article1(用于网站) http://example.com/news/admin(管理员)

在 .htaccess 中我已经写了

RewriteEngine On
# If the user types just "admin".
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/admin$ admin\.php [L,QSA]

# If the user enter in any admin section, like "admin/section".
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/admin\/(.*)$ admin\.php/$1 [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d    
RewriteRule ^(.*)$ index.php?/$1 [L]

前端工作正常,但是当我进入 mydomain.com/admin 时,它会抛出 404 not found 错误。请帮帮我。

感谢和问候

【问题讨论】:

    标签: .htaccess codeigniter


    【解决方案1】:

    我不太擅长 .htaccess,但从 CI website,您可以将其用于您的 .htaccess 规则

    RewriteEngine on
    RewriteCond $1 !^(index\.php|images|robots\.txt)
    RewriteRule ^(.*)$ /index.php/$1 [L]
    

    然后使用routes 重写您的网址。比在 .htaccess 文件中尝试要容易得多

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-09-07
      • 1970-01-01
      • 1970-01-01
      • 2013-11-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多