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.
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 ?
RewriteEngine On<br /> ## .com -> .fr<br /> Rewritecond %{HTTP_HOST} !^https://sitehote/$<br /> Rewriterule ^(.*) https://site.com/$1 [QSA,L,R=301]<br /><br /> SetOutputFilter DEFLATE<br /> 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"<br /><br /> # SECTION BEGIN GIT PROTECTION<br /> RedirectMatch 404 /\.git<br /> # SECTION END GIT PROTECTION<br /><br /><br /> # BEGIN WPSuperCache<br /> # The directives (lines) between "BEGIN WPSuperCache" and "END WPSuperCache" are<br /> # dynamically generated, and should only be modified via WordPress filters.<br /> # Any changes to the directives between these markers will be overwritten.<br /> <br /> RewriteEngine On<br /> RewriteBase /<br /> #If you serve pages from behind a proxy you may want to change 'RewriteCond %{HTTPS} on' to something more sensible<br /> AddDefaultCharset UTF-8<br /> RewriteCond %{REQUEST_URI} !^.*[^/]$<br /> RewriteCond %{REQUEST_URI} !^.*//.*$<br /> RewriteCond %{REQUEST_METHOD} !POST<br /> RewriteCond %{QUERY_STRING} ^$<br /> RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$<br /> RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]<br /> RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]<br /> RewriteCond %{HTTP:Accept-Encoding} gzip<br /> RewriteCond %{HTTPS} on<br /> RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html.gz -f<br /> RewriteRule ^(.*) "/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html.gz" [L]<br /><br /> RewriteCond %{REQUEST_URI} !^.*[^/]$<br /> RewriteCond %{REQUEST_URI} !^.*//.*$<br /> RewriteCond %{REQUEST_METHOD} !POST<br /> RewriteCond %{QUERY_STRING} ^$<br /> RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$<br /> RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]<br /> RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]<br /> RewriteCond %{HTTP:Accept-Encoding} gzip<br /> RewriteCond %{HTTPS} !on<br /> RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html.gz -f<br /> RewriteRule ^(.*) "/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html.gz" [L]<br /><br /> RewriteCond %{REQUEST_URI} !^.*[^/]$<br /> RewriteCond %{REQUEST_URI} !^.*//.*$<br /> RewriteCond %{REQUEST_METHOD} !POST<br /> RewriteCond %{QUERY_STRING} ^$<br /> RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$<br /> RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]<br /> RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]<br /> RewriteCond %{HTTPS} on<br /> RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html -f<br /> RewriteRule ^(.*) "/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html" [L]<br /><br /> RewriteCond %{REQUEST_URI} !^.*[^/]$<br /> RewriteCond %{REQUEST_URI} !^.*//.*$<br /> RewriteCond %{REQUEST_METHOD} !POST<br /> RewriteCond %{QUERY_STRING} ^$<br /> RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$<br /> RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]<br /> RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]<br /> RewriteCond %{HTTPS} !on<br /> RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html -f<br /> RewriteRule ^(.*) "/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html" [L]<br /> <br /><br /> # END WPSuperCache<br /> # BEGIN WordPress<br /> # Les directives (lignes) entre « BEGIN WordPress » et « END WordPress » sont générées<br /> # dynamiquement, et doivent être modifiées uniquement via les filtres WordPress.<br /> # Toute modification des directives situées entre ces marqueurs sera surchargée.<br /> <br /> RewriteEngine On<br /> RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]<br /> RewriteBase /<br /> RewriteRule ^index\.php$ - [L]<br /> RewriteCond %{REQUEST_FILENAME} !-f<br /> RewriteCond %{REQUEST_FILENAME} !-d<br /> RewriteRule . /index.php [L]<br /> <br /><br /> # 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