coigniter .htaccess
在amazon ec2中删除index.php不工作
RewriteEngine on
RewriteBase http://ec2-xx-xxx-xx-xx.us-west-2.compute.amazonaws.com/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
配置文件$config['base_url'] = 'http://ec2-xx-xxx-xx-xx.us-west-2.compute.amazonaws.com/';
您可以更改您的。像这样访问
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
在/etc/httpd/conf/httpd.conf(如果你使用AMI Linux)
修改AllowOverride None的值into "AllowOverride All"
之后重启你的apache,命令如下:
sudo service httpd restart
(if you use ubuntu)
Activate the mod_rewrite module with
sudo a2enmod rewrite
and restart the apache
sudo service apache2 restart
To use mod_rewrite from within .htaccess files (which is a very common use case), edit the default VirtualHost with
sudo nano /etc/apache2/sites-available/000-default.conf
Search for “DocumentRoot /var/www/html” and add the following lines directly below:
<Directory "/var/www/html">
AllowOverride All
</Directory>
Save and exit the nano editor via CTRL-X, “y” and ENTER.
Restart the server again:
sudo service apache2 restart
Justudin是正确的!
你也可以使用"AllowOverride All"规则,只适用于你的项目;在/etc/httpd/conf/httpd.conf中这样写:
<Directory "/var/www/your_website">
AllowOverride All
</Directory>
只有你可以对所有部署的应用使用"AllowOverride All"规则;写入/etc/httpd/conf/httpd.conf:
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>