WordPress.org

Ready to get started?Download WordPress

Forums

iThemes Security (formerly Better WP Security)
Redirecting the register link (20 posts)

  1. magnoct
    Member
    Posted 1 year ago #

    So I am trying to redirect the register link and am having A TON of trouble.

    All I want to do, with the hide backend option enabled, be able to redirect the register link to a custom registration page and I can't for the life of me figure out how to do it.

    Any help would be GREATLY appreciated.

    Thanks

    http://wordpress.org/extend/plugins/better-wp-security/

  2. Handoko
    Member
    Posted 1 year ago #

    Perhaps not much help. But you may try to examine the .htaccess file and modify it.

    But I warn you, every time you click save or update setting button on Better WP Security, this plugin will alter it to its default.

  3. magnoct
    Member
    Posted 1 year ago #

    I have tried the .htaccess but I can't figure it out, must be something to do with the secret key or something.

    Any ideas on the syntax? I would be at least happy to keep changing it manually until I figured out a suitable alternative.

  4. Handoko
    Member
    Posted 1 year ago #

    Here is the sample of my .htaccess

    ....
    RewriteRule ^register/?$ /wp-login.php?blablabla&action=register [R,L]
    
    RewriteCond %{SCRIPT_FILENAME} !^(.*)admin-ajax\.php
    RewriteCond %{HTTP_REFERER} !^(.*)yoursitename.com/wp-admin
    RewriteCond %{HTTP_REFERER} !^(.*)yoursitename.com/wp-login\.php
    RewriteCond %{HTTP_REFERER} !^(.*)yoursitename.com/login
    RewriteCond %{HTTP_REFERER} !^(.*)yoursitename.com/admin
    RewriteCond %{HTTP_REFERER} !^(.*)yoursitename.com/register
    RewriteCond %{QUERY_STRING} !^blablabla
    RewriteCond %{QUERY_STRING} !^action=logout
    RewriteCond %{QUERY_STRING} !^action=rp
    RewriteCond %{QUERY_STRING} !^action=register
    ....

    Note:
    - blablabla is your secret key
    - yoursitename.com is your website's domain name

    You may need to change the register in this line:
    RewriteRule ^register/?$ /wp-login.php?blablabla&action=register [R,L]
    (only the first one, not the register near the end)

    Also the register in this line:
    RewriteCond %{HTTP_REFERER} !^(.*)yoursitename.com/register

    I'm not expert in .htaccess file, but it does seem the 2 lines are what you need to edit.

    Remember, do backups before you edit the file.

  5. magnoct
    Member
    Posted 1 year ago #

    Cheers, I will give it a go.

  6. magnoct
    Member
    Posted 1 year ago #

    OK, so I still am unsure.

    My file looks similar to yours.

    I tried switching:

    RewriteRule ^register/?$ /wp-login.php?blablabla&action=register [R,L]

    to

    RewriteRule ^wp-login.php?blablabla&action=register/?$ /register [R,L]

    and it did nothing. I want mysite.com/wp-login.php?blablabla&action=register to redirect to mysite.com/register

    Did I do it wrong? Obviously I did :)

  7. Handoko
    Member
    Posted 1 year ago #

    The default recommended register link is register. For example you want to change it to newmember.

    So, this is the original:

    ...
    RewriteRule ^register/?$ /wp-login.php?blablabla&action=register [R,L]
    ...

    You need to change that to:

    ...
    RewriteRule ^newmember/?$ /wp-login.php?blablabla&action=register [R,L]
    ...

    You can't simply delete, you should change. From your example, you deleted the word: register. It's not correct.

    RewriteRule ^register/?$ /wp-login.php?blablabla&action=register [R,L]

  8. Handoko
    Member
    Posted 1 year ago #

    That was only the first you need to change. Then you should change this too:

    ...
    RewriteCond %{HTTP_REFERER} !^(.*)yoursitename.com/register
    ...

    Became:

    ...
    RewriteCond %{HTTP_REFERER} !^(.*)yoursitename.com/newmember
    ...
  9. magnoct
    Member
    Posted 1 year ago #

    Isn't that making newmember go to /wp-login.php?blablabla&action=register

    I want to make /wp-login.php?blablabla&action=register go to newmember (which in my case is a page called register)

  10. Handoko
    Member
    Posted 1 year ago #

    Oppositely as what you think. It makes the default wordpress /wp-login.php?blablabla&action=register can be accessed using the newmember link.

    Try it. I can't be sure to say I'm correct. But at least I believe so.

  11. magnoct
    Member
    Posted 1 year ago #

    Yes. However I do not want to access that page. Instead of accessing that page I want to access mysite.com/register because it has a custom registration form on it :) I do not want people to be able to access the generic wordpress registration form at all.

  12. Handoko
    Member
    Posted 1 year ago #

    Okay, maybe we should try something else.

    You said you have custom register link. Let's say it is: newmember.

    You need to tell your .htaccess not to block it. I see here could be the place:

    RewriteCond %{SCRIPT_FILENAME} !^(.*)admin-ajax\.php
    RewriteCond %{HTTP_REFERER} !^(.*)yoursitename.com/wp-admin
    RewriteCond %{HTTP_REFERER} !^(.*)yoursitename.com/wp-login\.php
    RewriteCond %{HTTP_REFERER} !^(.*)yoursitename.com/login
    RewriteCond %{HTTP_REFERER} !^(.*)yoursitename.com/admin
    RewriteCond %{HTTP_REFERER} !^(.*)yoursitename.com/register
    RewriteCond %{QUERY_STRING} !^blablabla
    RewriteCond %{QUERY_STRING} !^action=logout

    You may need to add this new line above RewriteCond %{HTTP_REFERER} !^(.*)yoursitename.com/register:

    ...
    RewriteCond %{HTTP_REFERER} !^(.*)yoursitename.com/newmember
    RewriteCond %{HTTP_REFERER} !^(.*)yoursitename.com/register
    ...

    Sorry, I misunderstood your meaning previously.

  13. Handoko
    Member
    Posted 1 year ago #

    Did it work?

    You said you're having A TON of trouble. What was the error message? Did you try to disable this Better WP Security and see the redirection work?

  14. magnoct
    Member
    Posted 1 year ago #

    Thanks I really appreciate your help. I am going to disable that function of the wp security plugin for the moment till my head stops hurting ;)

  15. Handoko
    Member
    Posted 1 year ago #

    It's me the one that should say sorry. Trying to help but make thing worse and hurt your head.

  16. magnoct
    Member
    Posted 1 year ago #

    OK, so this is what I have. I will be essentially copying and pasting what is sent back (minus the obvious changes of security key etc).

    OUTCOME: To have the register link on the login page point to my custom registration form located at mysite.com/register.

    Many thanks to whomever helps out with this.

    -----------------------------------------------------------

    RewriteRule ^mysite-login/?$ /wp-login.php?SECRET_KEY [R,L]

    RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in_.*$
    RewriteRule ^mysite-admin/?$ /wp-login.php?SECRET_KEY&redirect_to=/wp-admin/ [R,L]

    RewriteRule ^mysite-admin/?$ /wp-admin/?SECRET_KEY [R,L]

    RewriteRule ^mysite/?$ /wp-login.php?SECRET_KEY&action=register [R,L]

    RewriteCond %{SCRIPT_FILENAME} !^(.*)admin-ajax\.php
    RewriteCond %{HTTP_REFERER} !^(.*)com/wp-admin
    RewriteCond %{HTTP_REFERER} !^(.*)com/wp-login\.php
    RewriteCond %{HTTP_REFERER} !^(.*)com/mysite-login
    RewriteCond %{HTTP_REFERER} !^(.*)com/mysite-admin
    RewriteCond %{HTTP_REFERER} !^(.*)com/mysite
    RewriteCond %{QUERY_STRING} !^SECRET_KEY
    RewriteCond %{QUERY_STRING} !^action=logout
    RewriteCond %{QUERY_STRING} !^action=rp
    RewriteCond %{QUERY_STRING} !^action=register
    RewriteCond %{QUERY_STRING} !^action=postpass
    RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in_.*$
    RewriteRule ^.*wp-admin/?|^.*wp-login\.php /not_found [R,L]

    RewriteCond %{QUERY_STRING} ^loggedout=true
    RewriteRule ^.*$ /wp-login.php?SECRET_KEY [R,L]

  17. Handoko
    Member
    Posted 1 year ago #

    Okay, I made tests and they work on mine. Hope can work on yours too.

    My case:
    I want set my WordPress register page to:
    mysitename.com/en/about-us/

    Results:
    - Better WP Security doesn't block it.
    - Register link on Meta Widget works as what I want.
    - Register link on login page (wp-login.php) works as what I want.

    Here I change this line:

    ...
    RewriteRule ^register/?$ /wp-login.php?blablabla&action=register [R,L]
    ...

    Become this:

    ...
    RewriteRule ^register/?$ /en/about-us [R,L]
    ...

    Explanation:

    The things you need to change are the words: /wp-login.php and blablabla... in this line:
    RewriteRule ^register/?$ /wp-login.php?blablabla&action=register [R,L]
    To your new link.

    It works on my site, hope it works too on yours.

  18. magnoct
    Member
    Posted 1 year ago #

    YES!! This works perfectly. THANK YOU for your patience and help with this. Greatly appreciated. So simple in the end :)

  19. Handoko
    Member
    Posted 1 year ago #

    Glad to hear it works.

    Something you may need to know:

    Any manual modification in .htaccess file between # BEGIN Better WP Security and # END Better WP Security section will be altered to its default after you (edit and) save Better WP Security's settings.

  20. magnoct
    Member
    Posted 1 year ago #

    That's alright, I will just go back in and edit the file again. Hopefully the developer will include the ability to do this from within the plugin ;)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.