Problem displaying images

[ad_1]

**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>

&#x200B;

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 /

&#x200B;

RewriteRule \^index\\.php$ – \[L\]

&#x200B;

RewriteCond %{REQUEST\_FILENAME} !-f

RewriteCond %{REQUEST\_FILENAME} !-d

RewriteRule . /index.php \[L\]

</IfModule>

&#x200B;

&#x200B;

\# Redirection vers HTTPS (si activé)

<IfModule mod\_rewrite.c>

RewriteCond %{HTTPS} off

RewriteRule \^(.\*)$ https://%{HTTP\_HOST}%{REQUEST\_URI} \[L\]

</IfModule>

&#x200B;

\# Compression des fichiers

<IfModule mod\_deflate.c>

AddOutputFilterByType DEFLATE text/html text/plain text/css

</IfModule>

&#x200B;

&#x200B;

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer