linux - EC2 上的 Codeigniter URL 重写

标签 linux apache codeigniter amazon-web-services amazon-ec2

我有一套 Codeigniter 网站托管在
http://ec2-23-22-24-128.compute-1.amazonaws.com/

但是,当我尝试通过子域访问时失败:

http://ec2-23-22-24-128.compute-1.amazonaws.com/dashboard

http://ec2-23-22-24-128.compute-1.amazonaws.com/index.php/dashboard

我已经设置了 htaccess 并设置了 AllowOverride All

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

谁能给个建议?

最佳答案

如果您转到 Codeigniter 指南:
http://ellislab.com/codeigniter%20/user-guide/general/urls.html

它清楚地向您展示了您可以将其用于 mod_rewrite:

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

关于linux - EC2 上的 Codeigniter URL 重写,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20079796/

相关文章:

c++ - 想要开发我自己的基本上会显示 HTML、Javascript 和 Flash 的小型 C++ 浏览器,从哪里开始?

c++ - 如何从 SuperBible 获取 GLTools 库以在 Ubuntu 中工作?还是另一种选择?

python - 从 python 中的 xinput 测试读取标准输出

linux - Wget 能否返回 true 或 false(0 或 1)

Apache mod_rewrite 使用 302 而不是 https 重定向到 http

apache - .htaccess 文件不工作

php - Codeigniter 更新未按预期执行

django - 尝试从 View 写入文件时权限被拒绝

php - 在 Ubuntu 中运行 CodeIgniter 项目

php - Codeigniter Netbeans 使用 MysqlObjects 自动完成