我有一套 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/