【问题标题】:Extra index.php ? added in Url额外的 index.php ?在网址中添加
【发布时间】:2014-10-21 17:39:18
【问题描述】:

我在我的主机中使用 codeigniter 2.2.0 版本并配置了子域 (*.domainname.in)。以下是我的 .htaccess 文件内容

RewriteEngine on

RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

.htaccess 配置适用于以下网址

domainname.in ----> domainname.in
www.domainname.in --------> domainname.in
www.pune.domainname.in -----> pune.domainname.in

但是当我尝试使用此 URL http://pune.domainname.in/auth 访问我的身份验证控制器时

它使用 index.php?

重定向到下面的 URL
http://pune.domainname.in/index.php?/auth

这里是原域名网址

你能告诉我为什么会发生这种情况

谢谢

【问题讨论】:

  • 更改 $config['index_page'] = 'index.php';到 $config['index_page'] = '';在 application/config/config.php
  • @Vicky 这是你.htaccess中唯一的内容?
  • 是的,我的 .htaccess 文件包含上述配置
  • 这个.htaccess 里还有更多的规则吗?这个 .htaccess 位于哪里?
  • @anubhava - 没有其他规则,.htaccess 文件位于 dir public_html/businesswale.in/.htaccess 下

标签: php .htaccess codeigniter


【解决方案1】:

只需将该代码放入 .htaccess 文件中并尝试一下

RewriteEngine On
RewriteBase / businesswale.in/
RewriteCond %{REQUEST_URI} ^system.*
RewriteCond $1 !^(index\.php|images|js|uploads|css|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

【讨论】:

  • 没有运气仍然存在同样的问题
  • 您的 codeigniter 项目是在某个文件夹中还是在根目录中?
  • 这里是项目位置 public_html/businesswale.in/application 和 public_html/businesswale.in/system
  • businesswale.in 是一个文件夹吗?
【解决方案2】:

试试看

RewriteEngine On
RewriteBase /your_projct_name/
RewriteCond %{REQUEST_URI} ^system.*
RewriteCond $1 !^(index\.php|images|js|uploads|css|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

【讨论】:

    猜你喜欢
    • 2010-11-30
    • 1970-01-01
    • 2017-03-10
    • 2018-03-17
    • 1970-01-01
    • 2015-05-14
    • 1970-01-01
    • 2015-06-22
    相关资源
    最近更新 更多