Incorrect redirect problem on apache and https

hello, friends,

I have improbable impossible to solve I have searched all the forums and nothing to do I can’t find where is the problem ??

I explain I have an apache2 server with vhost that hosts two websites both with the letsencrypt-auto script solution that works both very well if you type in the browser.

https://www.j-link.fr

and

https://www.webmaster-wordpress.fr

OK

on the other hand, if I hit chrome

http://webmaster-wordpress.fr or webmaster-wordpress.fr the navigator refers well towards https://www.webmaster-wordpress.fr but once arrived on this page if I type: webmaster-wordpress.fr the I am redirected towards https://www.j-link.fr???

I don’t understand anything anymore ??

the worst thing is that I can’t share the link on facebook because facebook sees it and blocks me, telling me I’m trying to cheat ???

here are my Vhost settings

<VirtualHost *:80>
	     
      
      ServerName www.webmaster-wordpress.fr
	  ServerAlias webmaster-wordpress.fr
      DocumentRoot /var/www/xxxxxxx
	  
     
      <Directory /var/www/xxxxxxx/>
              Options Indexes FollowSymLinks MultiViews
              AllowOverride All
              Order allow,deny
              allow from all
			  FollowSymLinks Options
			  
      </Directory>

	
        

	
        
	ErrorLog ${APACHE_LOG_DIR}/webmaster-wordpress.fr-error.log
	CustomLog ${APACHE_LOG_DIR}/webmaster-wordpress.fr-access.log combined
	
	RewriteEngine on
 RewriteCond %{SERVER_NAME} =webmaster-wordpress.fr [OR]
RewriteCond %{SERVER_NAME} =www.webmaster-wordpress.fr
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
	</VirtualHost>

<IfModule mod_ssl.c>
<VirtualHost *:443>
	     
      
      ServerName www.webmaster-wordpress.fr
	  ServerAlias webmaster-wordpress.fr
      DocumentRoot /var/www/xxxxxxx
	  
     
      <Directory /var/www/xxxxxxx/>
              Options Indexes FollowSymLinks MultiViews
              AllowOverride All
              Order allow,deny
              allow from all
			  FollowSymLinks Options
			  
      </Directory>

	
        

	
        
	ErrorLog ${APACHE_LOG_DIR}/webmaster-wordpress.fr-error.log
	CustomLog ${APACHE_LOG_DIR}/webmaster-wordpress.fr-access.log combined
	
	RewriteEngine on
# Some rewrite rules in this file were disabled on your HTTPS site,
# because they have the potential to create redirection loops.



Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/webmaster-wordpress.fr/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/webmaster-wordpress.fr/privkey.pem
</VirtualHost>
</IfModule>

In DNS

I have this

webmaster-wordpress.fr  A 	185.244.129.17

www.webmaster-wordpress.fr  CNAME 	webmaster-wordpress.fr

in htaccess

I have

RewriteEngine On

RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.webmaster-wordpress.fr/$1 [R,L]
RewriteCond %{HTTP_HOST} ^webmaster-wordpress\.fr [NC]

RewriteCond %{SERVER_PORT} !=443
RewriteCond %{HTTP_HOST} ^webmaster-wordpress\.fr$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?webmaster-wordpress\.fr$ [NC]
RewriteRule ^(.*)$ "https\:\/\/www\.webmaster-wordpress\.fr\/$1" [R=301,L]






# BEGIN WordPress
# Les directives (lignes) entre 'BEGIN WordPress' et 'END WordPress' sont
# généré dynamiquement, et ne doivent uniquement être modifiées via les filtres WordPress.
# Toute modification des directives entre ces marqueurs sera outrepassée.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Thanks for help

Please put three backticks (```) just above and just below your configuration file for better readability.

Hi @michael10fr

checking your domain there is no such redirect visible - https://check-your-website.server-daten.de/?q=webmaster-wordpress.fr

The result

Domainname Http-Status redirect Sec. G
http://webmaster-wordpress.fr/ 185.244.129.17 301 https://www.webmaster-wordpress.fr/ Html is minified: 100,00 % 0.207 E
http://www.webmaster-wordpress.fr/ 185.244.129.17 301 https://www.webmaster-wordpress.fr/ Html is minified: 100,00 % 0.157 A
https://webmaster-wordpress.fr/ 185.244.129.17 301 https://www.webmaster-wordpress.fr/ 4.933 B
https://www.webmaster-wordpress.fr/ 185.244.129.17 GZip used - 27123 / 152501 - 82,21 % Inline-JavaScript (∑/total): 15/19331 Inline-CSS (∑/total): 8/23638 200 Html is minified: 152,07 % 5.730 B

Not perfect, but good enough. One https result.

But you should never mix redirects in config files with redirects in .htaccess. That’s duplicated.

1 Like

how to do this because I not find where to edit my message ? thanks to reply

ok done thanks Osiris

ok then I have to remove the redirect in the vhost or in the htaccess ??JuergenAuer

what’s the best thing to do?

please any solution ?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.