[英].htaccess not working in digital ocean server
当我按如下方式使用 .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>
文件/etc/apache2/mods-enabled/dir.conf
作为
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
我将 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';
这是工作。 所以请帮忙。
应该是这样的
<Directory /var/www/html/my_site/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.