【问题标题】:.htaccess file won't work.htaccess 文件不起作用
【发布时间】:2013-04-14 23:40:40
【问题描述】:

我正在使用 CodeIgniter 在 XAMPP 中运行我的应用程序。我有一个 .htaccess 文件,我不再需要在 url 中包含 index.php,但它不起作用。

我的 .htaccess 文件的内容是

Options +FollowSymLinks
RewriteEngine on
RewriteCond $1 !^(index\.php|crossdomain\.xml|captcha|images|assets|archive|css|js|uploads|robots\.txt)
RewriteRule ^(.*)$ /index.php?/$1 [L]

我已经将 AllowOverride 的所有目录设置为 All。我也已经启用了 mod_rewrite,但我的链接仍然不起作用。它不会转到指定的 URL,而是转到 XAMPP 主页。

在我的配置文件中也是这样的:

$config['base_url'] = '';
$config['index_page'] = '';

然后在视图中:

a href="/signup"

我做得对吗?请帮忙。

【问题讨论】:

  • 你在某个子目录中有codeigniter吗?

标签: .htaccess codeigniter


【解决方案1】:

试试

Options +FollowSymlinks
# Options +SymLinksIfOwnerMatch
RewriteEngine On
# RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond $1 !^(index\.php|monitor\.php|resources|test_gui|img|css|js|favicon\.ico|(.*)\.(png|js|jpg|swf|css|gif|ico|jpeg|scss)$)
RewriteRule ^(.*)$ index.php/$1 [L]

【讨论】:

  • 还是不行。我做对了吗?在我的配置文件中: $config['base_url'] = ''; $config['index_page'] = '';也在考虑:创建一个帐户我做得对吗?
猜你喜欢
  • 2015-06-04
  • 1970-01-01
  • 1970-01-01
  • 2013-12-16
  • 2015-03-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多