Vous cherchez un moyen de modifier votre URL de connexion et de l’améliorer ? Bien qu’il y ait probablement un plugin pour cela, nous avons créé un extrait de code rapide que vous pouvez utiliser pour réécrire .htaccess pour une meilleure URL de connexion WordPress.
Instructions:
Tout ce que vous avez à faire est d’ajouter ce code à votre fichier .htaccess :
RewriteRule ^login$ http://website.com/wp-login.php [NC,L]
Note : Si c’est la première fois que vous ajoutez des extraits de code dans WordPress, veuillez vous référer à notre guide sur la façon d’ajouter correctement des extraits de code dans WordPress, afin de ne pas briser accidentellement votre site.
Si vous avez aimé cet extrait de code, n’hésitez pas à consulter nos autres articles sur le site comme : 7 meilleurs services VPN pour les utilisateurs de WordPress et comment créer un formulaire de don sur WordPress.
I’m attempting to use the below:
RewriteRule ^login/(.*)$ wp-login.php/$1 [QSA,L]
Neither this nor the one provided in the article are working. Any suggestions?
You may want to reach out to your host and ask why it’s not working.
I didn’t test it myself, but how would the function work with define(‘FORCE_SSL_LOGIN’, true); (i.e. with HTTPS)?
should not affect anything, but keep a backup of your htaccess and test things out to make sure.
my website url redirect not working any help
If you have issue with htaccss you can use this plugin to do the same.
planetozh.com/blog/2011/01/pretty-login-url-a-simple-rewrite-api-plugin-example/
Didn’t work for me. Did I need to put it before or inside the #begin WordPress comment tags?
Hi Jerry, if you have problems getting this running you can try this plugin to do the same. http://planetozh.com/blog/2011/01/pretty-login-url-a-simple-rewrite-api-plugin-example/
nice one…
Cool glad you like it.
[…] to Kevin Chard for the cool […]
[…] link: Better WordPress login #dd_ajax_float{ background:none repeat scroll 0 0 #FFFFFF; border:1px solid #DDDDDD; float:left; […]
I couldnt get this to work in the way you describe, it will redirect…
http://www.website.com/login
But not…
http://www.website.com/login/
Notice the trailing slash. After a bit of fiddling I found that adding ?/? to the rule would allow for an optional slash…
RewriteRule ^login?/?$ http://website.com/wp-login.php [NC,L]
Im not mod_rewite expert, but this does seem to work as expected now. Hopefully you’ll find this helpful 🙂
Hi Dale, are you sure you have everything correct? because to do a redirect we would need to be using a R flag for redirect. If you are having problems ozh has a wordpress plugin that should help.
http://planetozh.com/blog/2011/01/pretty-login-url-a-simple-rewrite-api-plugin-example/
Not sure if I meant redirect, I think I should have said “rewrite”. My point was that to be consistent with the way WordPress rewrites its permalinks, when I tried your example I thought it should also allow for an optional trailing slash.
In fact, unfortunately my example above is slightly incorrect, according to the mod_rewrite docs at apache.org…
http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#RewriteRule
… we can use the quantifier “?” (0 or 1 occurrences of the preceding text) to allow for an optional slash. See the following example…
RewriteRule ^login/?$ http://website.com/wp-login.php [NC,L]
Thanks for the link by the way. The Ozh plugin does actually use the same rule given in my example, wish I had read their page before posting my first comment!
Thanks Kevin, yoru site is a goldmine 🙂
No problem Dale glad you got things sorted out. Goldmine! That is nice to hear, glad you enjoy the site.
[…] Via : Lien […]
Nice one Kevin!
Thanks Christopher, glad you liked it.
Just use:
RewriteRule ^login/?$ /wp-login.php [NC,L]
[…] to Kevin Chard for the cool tip! If you enjoyed this article, please consider sharing it! tweetmeme_style = […]