我已经在digitalocean上设置了虚拟主机。一切正常,除了mode_rewrite 这是我的mysite.com.conf文件
<VirtualHost *:80>
ServerAdmin info@mysite.com
ServerName mysite.com
ServerAlias www.mysite.com
DocumentRoot /var/www/mysite.com/public_html
<Directory /var/www/mysite.com/public_html>
Options -Indexes +FollowSymLinks
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
RewriteEngine on
RewriteCond %{SERVER_NAME} =mysite.com [OR]
RewriteCond %{SERVER_NAME} =www.mysite.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
这是我的htaccess代码
RewriteEngine on
RewriteRule ^product/(.*)/$ product.php?id=$1 [NC,L]
RewriteRule ^([^\.]+)/$ $1.php [NC,L]
每当我访问任何页面时,它都会给我404错误。
我也在下面尝试过
<Directory /var/www/mysite.com>
和
<Directory /var/www/>
有人可以指出我如何解决此问题。竭诚为您服务。