[当我按如下方式使用.htaccess时,我得到的是The requested URL was not found on this server
错误。我的配置为
Digitalocean:var / www / html / my_site / 。htaccess as
<IfModule mod_rewrite.c>
# Rules to serve URLs which point to files directly
# ----------
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
我更改了/etc/apache2/apache2.conf来自
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
收件人
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
我将myapp \ application \ config \ config.php更改为$config['index_page'] = '';
和$config['uri_protocol'] = 'REQUEST_URI';
并且我已经在我的digitalocean服务器中运行了以下命令
sudo a2enmod rewrite
sudo service apache2 reload
当我在浏览器中打开my_site时,完成所有这些操作后,我收到以下消息
如果删除.htaccess并将myapp \ application \ config \ config.php重置为$config['index_page'] = 'index.php';
,它正在工作。所以请帮忙。
<IfModule mod_rewrite.c> # Rules to serve URLs which point to files directly # ---------- RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] </IfModule>
不是使index.php在/上可见的东西。