**I have a WordPress project on the cloud that I am migrating to an On-Premise server. I exported my project and the database and imported them on an Ubuntu 22.04 machine. Everything went well, except for the images on my site.**
**No images are displayed on my site. After a quick diagnosis, I realized that the site wants to execute a URL and it redirects to login.php to display the image. For example:**
**https://172.16.4.205/wp-content/uploads/2021/02/image.png redirects to** [**https://172.16.4.205/wp-login.php?redirect\_to=/wp-content/uploads/2021/02/image.png**](https://172.16.4.205/wp-login.php?redirect_to=/wp-content/uploads/2021/02/royaume_du_maroc_logo.png)
​
**file config apache**
<VirtualHost \*:443>
DocumentRoot /var/www/html
SSLEngine on
SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt
SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key
<Directory /var/www/html/>
Options +Indexes
AllowOverride All
RewriteEngine On
Require all granted
Allow from All
</Directory>
​
ErrorLog ${APACHE\_LOG\_DIR}/error.log
CustomLog ${APACHE\_LOG\_DIR}/access.log combined
</VirtualHost>
config .htacces
\# Règles de réécriture pour WordPress
<IfModule mod\_rewrite.c>
RewriteEngine On
RewriteBase /
​
RewriteRule \^index\\.php$ – \[L\]
​
RewriteCond %{REQUEST\_FILENAME} !-f
RewriteCond %{REQUEST\_FILENAME} !-d
RewriteRule . /index.php \[L\]
</IfModule>
​
​
\# Redirection vers HTTPS (si activé)
<IfModule mod\_rewrite.c>
RewriteCond %{HTTPS} off
RewriteRule \^(.\*)$ https://%{HTTP\_HOST}%{REQUEST\_URI} \[L\]
</IfModule>
​
\# Compression des fichiers
<IfModule mod\_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/css
</IfModule>
​
​
[ad_2]