Avez-vous des difficultés à trouver le fichier .htaccess dans WordPress ?
L’une des questions les plus fréquemment posées par les débutants est la suivante : « Où se trouve mon fichier .htaccess ? ». Ne pas pouvoir le trouver peut être frustrant, car vous pouvez avoir besoin de le modifier ou de le supprimer pour corriger des erreurs WordPress courantes.
Dans cet article, nous allons vous expliquer pourquoi vous ne trouvez pas le fichier .htaccess sur votre site WordPress et vous afficher comment le localiser.
![Finding the .htaccess file for your WordPress site Finding the .htaccess file for your WordPress site](https://www.wpbeginner.com/wp-content/uploads/2019/03/findinghtaccessfile.png)
Qu’est-ce que le fichier .htaccess ?
Le fichier .htaccess est un fichier de configuration du serveur qui indique à votre serveur comment gérer certaines tâches sur votre site. Il est situé dans le dossier racine de votre site WordPress.org.
Ce fichier PHP peut notamment gérer les liens permanents, rediriger les utilisateurs/utilisatrices, protéger la zone d’administration par un mot de passe, etc. Considérez-le comme un manuel d’instructions pour votre serveur web.
Pourquoi le fichier .htaccess est-il manquant ?
Il se peut que vous ne trouviez pas le fichier .htaccess parce qu’il est masqué par votre FTP ou votre gestionnaire de fichiers. Ou bien il n’existe pas et vous devrez peut-être actualiser vos paramètres permaliens.
Nous expliquerons ces deux scénarios avec des solutions pour localiser le fichier. N’hésitez pas à utiliser ces liens rapides pour passer à un scénario spécifique :
Scénario 1 : Votre FTP ou votre gestionnaire de fichiers n’affiche pas les fichiers masqués
Le point qui précède le nom du fichier .htaccess indique qu’il s’agit d’un fichier masqué. Par défaut, lorsque vous vous connectez à votre serveur d’hébergement WordPress à l’aide d’un client FTP, celui-ci n’affiche pas les fichiers masqués.
Pour rendre les fichiers masqués visibles, vous devez modifier vos Réglages FTP.
Dans FileZilla, vous trouverez cette option en cliquant sur l’élément de menu « Serveur » et en sélectionnant « Forcer l’affichage des fichiers masqués ».
![Show hidden files in FileZilla Show hidden files in FileZilla](https://www.wpbeginner.com/wp-content/uploads/2019/03/showhiddenfiles.png)
Pour les autres clients FTP, vous trouverez l’option permettant d’afficher les fichiers masqués dans les Réglages de l’appli ou dans le menu des préférences. Après avoir activé cette option, vous pourrez voir tous les fichiers masqués, y compris le fichier .htaccess de votre site WordPress.
Pour ceux qui utilisent l’application Gestionnaire de fichiers dans le panneau de contrôle du compte hébergeur, vous trouverez l’option permettant d’afficher les fichiers cachés.
Si votre fournisseur d’hébergement utilise cPanel, vous pouvez cliquer sur le bouton « Réglages » dans le coin supérieur droit.
![Show hidden files in cPanel Show hidden files in cPanel](https://www.wpbeginner.com/wp-content/uploads/2019/04/show-hidden-files-cpanel.jpg)
Scénario 2 : Le fichier .htaccess n’existe pas
La deuxième raison la plus fréquente de l’absence d’un fichier .htaccess est que votre site WordPress ne l’a pas encore généré.
WordPress génère automatiquement un fichier .htaccess car elle requiert une redirection correcte des permaliens.
Si votre fichier .htaccess est manquant, alors la première chose à faire est de visiter Réglages » Permaliens depuis votre tableau de bord WordPress. Ensuite, cliquez sur le bouton » Enregistrer les modifications » sans modifier les réglages de la structure des permaliens.
![Permalinks settings page Permalinks settings page](https://www.wpbeginner.com/wp-content/uploads/2019/03/permalinks.jpg)
WordPress va maintenant essayer de générer le fichier .htaccess pour vous.
Dans certains cas, WordPress peut ne pas être en mesure de générer le fichier .htaccess en raison d’un problème de droits d’accès au fichier. Si c’est le cas, il affichera un message en bas de la page Réglages » Permaliens indiquant que le fichier ‘.htaccess n’est pas accessible en écriture’.
![htaccess file not writeable htaccess file not writeable](https://www.wpbeginner.com/wp-content/uploads/2019/03/htaccesscode.png)
Vous devez créer manuellement un nouveau fichier .htaccess et y ajouter l’extrait de code suivant :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /mysite/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
Il suffit de copier et de coller ce code dans un éditeur de texte comme le Bloc-notes. Ensuite, vous devez l’enregistrer en tant que fichier .htaccess sur votre ordinateur.
Connectez-vous maintenant à votre site à l’aide d’un client FTP et téléversez le fichier .htaccess depuis votre ordinateur.
Si vous obtenez une erreur lors du téléversement du fichier, vous devez modifier les droits de votre répertoire racine.
Supposons que tous vos fichiers WordPress se trouvent sous /home/johnsmith/public_html/. Le dossier public_html est donc votre répertoire racine. Vous devez vous rendre dans son répertoire parent et cliquer avec le bouton droit de la souris sur le dossier public_html.
Sélectionnez ensuite « Droits des fichiers », ce qui ouvre une boîte de dialogue sur les droits des fichiers.
Vous devez saisir « 755 » dans la case « Valeur numérique », puis essayer de téléverser votre fichier .htaccess dans le dossier public_html.
![Changing file permissions via FTP Changing file permissions via FTP](https://www.wpbeginner.com/wp-content/uploads/2019/03/ftpfilepermission.jpg)
Et c’est tout ! Si vous êtes curieux au sujet de .htaccess, vous pouvez en savoir plus dans notre article sur les astuces .htaccess les plus utiles pour WordPress.
Nous espérons que cet article vous a aidé à trouver le fichier .htaccess sur votre site WordPress. Vous pouvez également consulter notre guide de dépannage WordPress pour corriger les erreurs WordPress les plus courantes et notre liste des meilleurs plugins WordPress pour développer votre site.
Si vous avez aimé cet article, veuillez alors vous abonner à notre chaîne YouTube pour obtenir des tutoriels vidéo sur WordPress. Vous pouvez également nous trouver sur Twitter et Facebook.
Syed Balkhi says
Hey WPBeginner readers,
Did you know you can win exciting prizes by commenting on WPBeginner?
Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
You can get more details about the contest from here.
Start sharing your thoughts below to stand a chance to win!
MarownIOM says
Thank you very much. Re-creating the .htaccess file from the Permalinks section worked.
WPBeginner Support says
Glad our guide was able to assist!
Administrateur
Shahbaz says
Thank you very much. This article is very helpful.
WPBeginner Support says
Glad our guide was helpful![:)](https://www.wpbeginner.com/fr/wp-content/plugins/classic-smilies/img/icon_smile.gif)
Administrateur
Raafat says
Thank you. You saved my life.![:)](https://www.wpbeginner.com/fr/wp-content/plugins/classic-smilies/img/icon_smile.gif)
WPBeginner Support says
You’re welcome, glad our guide was helpful![:)](https://www.wpbeginner.com/fr/wp-content/plugins/classic-smilies/img/icon_smile.gif)
Administrateur
Syed Mehmood says
In my Cpanel there are so many .htaccess files so can i delete them or not?
WPBeginner Support says
If you have multiple with the same name for some reason, you may want to check with your hosting provider’s support in case it was set up for something specific to your hosting provider.
Administrateur
Jessica says
This worked perfectly, thank you!
WPBeginner Support says
You’re welcome![:)](https://www.wpbeginner.com/fr/wp-content/plugins/classic-smilies/img/icon_smile.gif)
Administrateur
Amber says
I still can’t find the .htaccess file. I’m using a free WP site (so plugins aren’t available), and there’s no « permalinks » section in the admin for me to manually create the file. What should I do?
Thanks!
WPBeginner Support says
WordPress.com does not give access to your htaccess file. If you wanted that you would need to use WordPress.org and we have our comparison guide on the two below:
https://www.wpbeginner.com/beginners-guide/self-hosted-wordpress-org-vs-free-wordpress-com-infograph/
Administrateur
Thomas Jones says
After a php version update my site went down. The hosting company are no help at all. I read your blog and updated my permalinks file and all works fine now. Many thanks, Tom : )
WPBeginner Support says
Glad our recommendation was able to help![:)](https://www.wpbeginner.com/fr/wp-content/plugins/classic-smilies/img/icon_smile.gif)
Administrateur
Thor Erik Just Olsen says
Thank you! Saved my day![:D](https://www.wpbeginner.com/fr/wp-content/plugins/classic-smilies/img/icon_biggrin.gif)
WPBeginner Support says
Glad our guide could help![:)](https://www.wpbeginner.com/fr/wp-content/plugins/classic-smilies/img/icon_smile.gif)
Administrateur
Urdesigno says
Thank you this artical is very help full
WPBeginner Support says
You’re welcome, glad our guide was helpful![:)](https://www.wpbeginner.com/fr/wp-content/plugins/classic-smilies/img/icon_smile.gif)
Administrateur
Rafael says
Great! It was just hidden, in WinSCP
WPBeginner Support says
Glad our recommendation could help![:)](https://www.wpbeginner.com/fr/wp-content/plugins/classic-smilies/img/icon_smile.gif)
Administrateur
pankaj says
Quite a Helpful article, thankyou. one question though do we really need .htaccess file as being an administrator?
WPBeginner Support says
Yes, your site should have an .htaccess file. It handles some things on your site and gives you more tools you can use.
Administrateur
Tammy says
This was so helpful, thank you!
WPBeginner Support says
You’re welcome, glad our guide was helpful![:)](https://www.wpbeginner.com/fr/wp-content/plugins/classic-smilies/img/icon_smile.gif)
Administrateur
Dev says
Thanks so much! This solve my issues, i was about to get crazy, thanks!
WPBeginner Support says
You’re welcome, glad our guide could help![:)](https://www.wpbeginner.com/fr/wp-content/plugins/classic-smilies/img/icon_smile.gif)
Administrateur
Michael says
Saved my day! Thanks
WPBeginner Support says
You’re welcome, glad our article could help![:)](https://www.wpbeginner.com/fr/wp-content/plugins/classic-smilies/img/icon_smile.gif)
Administrateur
Arnold Alphonce says
Thanks that was really helpful. I did not save changes for the first time and also the permission as you said. Once i did that i worked fine thanks again
WPBeginner Support says
You’re welcome, glad we could be helpful![:)](https://www.wpbeginner.com/fr/wp-content/plugins/classic-smilies/img/icon_smile.gif)
Administrateur
Arif Billah says
Thanks for the help, this blog helps me a lot, i had been working to resolve this for 3 days.
in my case file name was not written, i have identified it with file type.
100% beginner also not an IT guy.![:)](https://www.wpbeginner.com/fr/wp-content/plugins/classic-smilies/img/icon_smile.gif)
once again Thanks a lot
WPBeginner Support says
Glad our article could help yo fix the issue![:)](https://www.wpbeginner.com/fr/wp-content/plugins/classic-smilies/img/icon_smile.gif)
Administrateur
Luke Cavanagh says
Also you may not be able to the find .htaccess file on the site server, since NGNIX is being used.
WPBeginner Support says
You are correct, that is another possibility but not always a common one![:)](https://www.wpbeginner.com/fr/wp-content/plugins/classic-smilies/img/icon_smile.gif)
Administrateur
gurdeep says
hi. I tried to see if the file was hidden. This didn’t start showing .htaccess. I then went to permalinks and saved changes (even tried updating some settings and updating again) a few times. I didn’t get any text from WP. It just accepted the changes. I still can’t see the htaccess file.
Not sure why this is happening. Can you please help.
WPBeginner Support says
You may want to check your hosting provider to see if they see the htaccess on their end.
Administrateur
sany says
hey there,
I followed the instructions step by step, however I still cannot find the .htaccess -.-
when I create one on my mac with text pad (or should I use word doc?) and try to paste it via ftp (filezilla) in the » / » folder but it still does’nt work.
The links on my wordpress shows « 404 Not Found nginx »
please help!!
WPBeginner Support says
You may want to ensure you don’t have a file extension on the end of your .htaccess file as that is one of the more common reasons it does not work.
Administrateur
mohit verma says
Go in WordPress and then click on settings and then select permalinks and then select plain and then save changes
abhishek says
hey . i need your help regarding my cpanel . it shows only text and when i click on any tool it gets logged out. i have tried many ways to repair my cpanel but can’t resolved it . i m using cloudflare though.
WPBeginner Support says
Hi Abhishek,
Please contact your hosting provider. They will be able to fix this issue for you.
Administrateur
Don Herman says
This probably worked once, but no longer. No message appears on the Permalinks page when you save it. Show Hidden Files in FileZilla doesn’t reveal the .htaccess file. Pretty much useless from the get-go.
WPBeginner Support says
Hi Don,
It still works. .htaccess file is hidden by default. If you cannot see it in your FTP client, then please try a different FTP program.
Administrateur
Ted Fisher says
Very weird! Please help. I did find my .htaccess file and copied and pasted the code into it. Now all pages are secure except the home page. Any help would be appreciated.
thanks,
Ted
gretchen says
Petra says
I have the same problem.
Carolina says
I have the same problem. No .htaccess using CuteFTP (yes, I enabled filters) and the file manager in Plesk. Does this mean there isn’t one??? Please answer!!!
WPBeginner Support says
Hi Carolina,
If your web hosting server is using a different software like Windows or Nginx then you may not be able ot find .htaccess file.
Anj says
It helps a lot .. Thanks .. i can access again my website .
Neil says
The htaccess rewrite worked! Thanks ever so much for your help. Brain is fried after a complete loss of dashboard today. I had to create a .htaccess file and upload it through ftp.
Thanks again
Kathy says
OMG thank you. I added this to my .htaccess file
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300
FTP wouldn’t let me overwrite .htaccess so I uploaded it as .htaccess-new then deleted .htaccess and renamed .htaccess-new to .htaccess
Yay!
Annie says
Hello,
I am unable to select any of the code in the box to recreate my .htaccess file. It appears to be an image file only…
Thanks.
Emilio says
Thank you! You saved my day, I started to get worried I will not fix this. I appreciate it, honestly.
Tony says
Can you please tell me how to keep WP back end log in longer time when i am on back end for uploading? because due to SSL, it automatically logs out of the account in some minutes and ask me to log in again. this is troublesome, thank you
Nadir says
I have the same problem! did you find a solution?
please help.
thanks
Kay Collier says
The permalinks solution didn’t work for me either.
In cPanel I have a page that will allow me to edit 403 (forbidden) but when I click on the code to edit I’m absolutely lost which is very annoying as I’m sure it must be easy to do, if only I knew how!
Can anyone explain please?
Sincerely
Kay
Axel says
Hi!
I am new to wordpress and have set up my wordpress site this weekend. To ensure it is safe, I followed the htaccess/htpasswd settings today and all worked fine.
After some hours, I could not access my wordpress site anymore but get the error message
[Tue Nov 01 20:31:36 2016] [authn_file:error] [pid 26428] [client xxx.xxx.xx.xxx] [host xxx.xxx.de] AH01620: Could not open password file: /XXX.htpasswd
How can I overcome this issue?
thanks for any help!
Axel
WPBeginner Support says
Please contact your hosting provider. They will be able to assist you better. Meanwhile, you can try steps mentioned in our WordPress troubleshooting guide.
Administrateur
juan luis says
You have a wonderful page. My only objection is that font sizes are too samall. I print everything I read
dt.k says
Why don’t you just zoom your browser window in to make the text larger?
Jazib says
i don’t want to use ftp client method. Tell me how to edit htaccess file via cpanel
lmahdi says
thanks
it’s salve me
Fahad Saleem says
Thanks it really helped.
Keep sharing more wisdom.!
Habib says
Really interesting and informative post. I like all posts of wpbeginner.com. nice website.
Caspar says
Hey.. I played around with WP rocket and cleared my .htaccess – Now i am missing elements and sections of my webpage. I have tired to disable minifying. But still nothing happens.
Really i have no idea of what made these sections disappear . Any one have an idea of what i should try?
Olatuga Moses says
Is there any way or some how I can make my audio wp content downloading be available to all mobile device,like if I just upload audio to W-P it is only some specific device that would be able to download it with streaming online.like I need help on how to make my audio link download on all mobile device.
Suzy says
Having tried the above I still can’t see my htacess file and I do not get the message saying not rewritable under permalinks. Can anybody help, I’ve been getting the 500 Internal Server Error for two days now and am desperate to update to the latest version of WordPress. My site is slow and shows the message frequently. Any help would be gratefully appreciated.
aditya says
WP Maximum Execution Time Exceeded.
give it a try.
its working now i get relief.
thanks for your help.
i really appreciate your work.
thanks thanks thanks!!!
Tan says
Thank you! You wake me up from the death!
jackel says
Solved: Yesterday I started my second wp site, all went well until I noticed that all permalink options didn`t work except the default one, every time I changed to another permalink structure, I received the famous 404 error. I cross referanced with my first wp site, and noticed that the web.config file was not in the root. Obviously I copied and pasted the web.config file from my first site to my new site, refreshed and now all permalinks work fine.
Talib says
dear can we use .htaccess Plugin by aubrey poortwood, is it bettter or not
Miello says
thanks for this! Just ran into this and this helped me solve my issue.
McGhori says
Thanks you so much Balkhi, Your information is brilliant Boss. Thanks again.
Dave Naylor says
It’s worth pointing out that your .htaccess file might be missing because you don’t need one. For instance the Nginx web server doesn’t use .htaccess files for security and performance reasons.
Pierre Gazzola says
Hope you do not intended to leave permission at 755 for the file or anyone would be able to hack your site via that file no ?
WPBeginner Support says
755 is safe, 777 will make your files writable by anyone.
Administrateur
Howard Lee Harkness says
I had occasion to look around for some redirection plugins for WP, and I noticed that some implement « hit counters. » I suspect all of them have to put something in the .htaccess file. I would love to see an article that goes into more depth on redirection, link cloaking, and hit counters.
Kasa says
Isnt it easier co create .htacces right in cPanel (if you dont have it) rather than saving in notepad and uploading via ftp?
I think that way is more easier and faster.
WPBeginner Support says
Kasa yes this should work too, however many users don’t have access to cPanel. Some webhosts use their own hosting control panels.
Administrateur