Transfert Site - Erreur lors de la connexion à la base de données
BMPCreated with Sketch.BMPZIPCreated with Sketch.ZIPXLSCreated with Sketch.XLSTXTCreated with Sketch.TXTPPTCreated with Sketch.PPTPNGCreated with Sketch.PNGPDFCreated with Sketch.PDFJPGCreated with Sketch.JPGGIFCreated with Sketch.GIFDOCCreated with Sketch.DOC Error Created with Sketch.
Question

Transfert Site - Erreur lors de la connexion à la base de données

Par
ZoubidaL
Créé le 2021-01-18 12:07:33 (edited on 2024-09-04 13:07:07) dans Hébergements Web

Bonjour,
Nous venons de transférer manuellement notre site web sur notre hébergement OVH (via FileZilla) ainsi cependant lorsque l'on essaye d'accéder au site nous avons le message suivant : "Erreur lors de la connexion à la base de données".
Quelle est la marche à suivre pour corriger le problème ?
En vous remerciant par avance.


6 réponses ( Latest reply on 2021-01-18 16:24:19 Par
Gaston_Phone
)

Bonjour @ZoubidaL

Origine de votre Site WEB :
* Votre PC ?
* Autre ?

Avez-vous transféré la base de données chez OVH ?

Bonjour,

L'origine du site web vient d'un autre hébergeur (Infomaniak).
Oui, j'ai transféré la base de données qui était sur l'autre hébergeur sur OVH.

Il va falloir dans le fichier de configuration du site modifier les accès à la base de données ainsi que l'adresse du site

J'avais fait une faute de frappe dans la modification des accès à la base de données... Cela fonctionne maintenant, merci beaucoup !
Cependant je ne trouve pas où modifier l'adresse du site car maintenant j'ai une redirection sur l'ancien nom du site.

Mettre au tout début de **/www/.htaccess** :
> RewriteEngine On
> ## .com -> .fr
> Rewritecond %{HTTP_HOST} !^AncienSITE$
> Rewriterule ^(.*) https://NouveauSITE/$1 [QSA,L,R=301]

Je vous remercie mais ça ne fonctionne toujours pas...

Pouvez-vous me faire une copie de ce que vous avez écrit dans le fichier .htaccess ?

```text RewriteEngine On
## .com -> .fr
Rewritecond %{HTTP_HOST} !^https://sitehote/$
Rewriterule ^(.*) https://site.com/$1 [QSA,L,R=301]

SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE "application/atom+xml" "application/javascript" "application/json" "application/ld+json" "application/manifest+json" "application/rdf+xml" "application/rss+xml" "application/schema+json" "application/vnd.geo+json" "application/vnd.ms-fontobject" "application/x-font-ttf" "application/x-javascript" "application/x-web-app-manifest+json" "application/xhtml+xml" "application/xml" "font/eot" "font/opentype" "image/bmp" "image/svg+xml" "image/vnd.microsoft.icon" "image/x-icon" "text/cache-manifest" "text/css" "text/html" "text/javascript" "text/plain" "text/vcard" "text/vnd.rim.location.xloc" "text/vtt" "text/x-component" "text/x-cross-domain-policy" "text/xml"

# SECTION BEGIN GIT PROTECTION
RedirectMatch 404 /\.git
# SECTION END GIT PROTECTION


# BEGIN WPSuperCache
# The directives (lines) between "BEGIN WPSuperCache" and "END WPSuperCache" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.

RewriteEngine On
RewriteBase /
#If you serve pages from behind a proxy you may want to change 'RewriteCond %{HTTPS} on' to something more sensible
AddDefaultCharset UTF-8
RewriteCond %{REQUEST_URI} !^.*[^/]$
RewriteCond %{REQUEST_URI} !^.*//.*$
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{HTTPS} on
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html.gz -f
RewriteRule ^(.*) "/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html.gz" [L]

RewriteCond %{REQUEST_URI} !^.*[^/]$
RewriteCond %{REQUEST_URI} !^.*//.*$
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{HTTPS} !on
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html.gz -f
RewriteRule ^(.*) "/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html.gz" [L]

RewriteCond %{REQUEST_URI} !^.*[^/]$
RewriteCond %{REQUEST_URI} !^.*//.*$
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTPS} on
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html -f
RewriteRule ^(.*) "/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html" [L]

RewriteCond %{REQUEST_URI} !^.*[^/]$
RewriteCond %{REQUEST_URI} !^.*//.*$
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTPS} !on
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html -f
RewriteRule ^(.*) "/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html" [L]


# END WPSuperCache
# BEGIN WordPress
# Les directives (lignes) entre « BEGIN WordPress » et « END WordPress » sont générées
# dynamiquement, et doivent être modifiées uniquement via les filtres WordPress.
# Toute modification des directives situées entre ces marqueurs sera surchargée.

RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]


# END WordPress ```

OK c'est du WordPress.

Ce fichier .htaccess se trouve où :
* Chez infomaniak ?
* Chez OVH ?

Chez OVH (à terme je souhaiterais supprimer celui chez infomaniak)

Personnellement pour le .htaccess, je supprimerai :
> RewriteEngine On
> ## .com -> .fr
> Rewritecond %{HTTP_HOST} !^https://kp67taeyyu.preview.infomaniak.website/$
> Rewriterule ^(.*) https://TonDomaine.com/$1 [QSA,L,R=301]

Et je mettrai au tout début :
> RewriteEngine On
> ## http -> https
> RewriteCond %{HTTPS} off
> RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE,QSA]

Puis dans le menu d'admonistration de WordPress je corrigerai les adresses de site et je mettrai : l'adresse de mon domaine