I have a problem when moving my website to VULTR VPS - Ubuntu 20.04LTS with Apache - 2.4.41
I'm using Opencart for my website and my problem is whenever I move .htaccess file to the new hosting, the website will display 500 error code.
So I tried to enable rewrite mod.
$ sudo a2enmod rewrite
restart the server
$ sudo systemctl restart apache2
Then I add some code to the following config files
/etc/apache2/sites-available/000-default.conf
/etc/apache2/sites-enabled/000-default.conf
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
I also change the code of apache2.conf file in /etc/apache2/apache2.conf
From
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
To
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
I also restart the server to make sure it takes effect.
$ sudo systemctl restart apache2
Unfortunately, I got no luck with it. Whenever I move the .HTACCESS file to VULTR. The website still display 500 error code.
enter image description here
Here is the code inside my .HTACCESS file.
Options +FollowSymlinks
# Prevent Directoy listing
Options -Indexes
# Prevent Direct Access to files
<FilesMatch "(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))">
Require all denied
## For apache 2.2 and older, replace "Require all denied" with these two lines :
# Order deny,allow
# Deny from all
</FilesMatch>
# SEO URL Settings
RewriteEngine On
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/
RewriteBase /
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\.website\.com$ [NC]
RewriteRule ^(.*)$ https://www.website.com/$1 [L,R=301]
RewriteRule ^sitemap.xml$ index.php?route=extension/feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L]
RewriteRule ^system/download/(.*) index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
Could you please help me with this issue? I really appreciate your help