Name-based virtual host configuration in Apache seems to cause a “500 Internal Server Error”

Question

I have the following problem: I made 10 WordPress sites for 1one client and now he needs me to configure the domains in his VPS.

Based on some searches I did on the internet, the first thing I needed to do was create a new file of configuration within /etc/apache2/sites-available and enable it with a2ensite. Perfect! I did it and it was as follows for each site:

<VirtualHost *:80>
    ServerAdmin (my email)
    ServerName (configured domain)
    ServerAlias (configured domain)
    DocumentRoot /var/www/html/10_sites/
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    <Directory /var/www/html/10_sites>
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

My .htaccess:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^index.php$ - [L]
# add a trailing slash to /wp-admin
RewriteBase /10_sites/
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*.php)$ $2 [L]
RewriteRule . index.php [L]

</IfModule>

After that, I had to go to the websites and change the website address, I went there and changed it to the correct address.

After enabling the 2 configurations it worked as I wanted today it opens the site in the domain. So theoretically everything would be right.

But then I came across a problem, when I open the site and I go to the administrative area (/wp-admin) and I try to login it says:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at (my email) to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

0
Nasser Othman 4 months 0 Answers 8 views 0

Leave an answer