Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Oct 2008
    Location
    Poland
    Posts
    382
    Thanks
    150
    Thanked 2 Times in 2 Posts

    What's the difference between the two rules?

    Hello,

    can anybody explain what are the difference between the following two?
    Code:
    <IfModule mod_rewrite.c>
    	RewriteEngine On
    	RewriteCond %{REQUEST_METHOD} POST
    	RewriteCond %{REQUEST_URI} .(wp-comments-post|wp-login)\.php*
    	RewriteCond %{HTTP_REFERER} !.*mysite.com.* [OR]
    	RewriteCond %{HTTP_USER_AGENT} ^$
    	RewriteRule (.*) http://%{REMOTE_ADDR}/$ [R=301,L]
    </ifModule>
    Code:
    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_METHOD} =POST
    RewriteCond %{HTTP_REFERER} !^http://(.*)?.example.com [NC]
    RewriteCond %{REQUEST_URI} ^/wp-login\.php(.*)$ [OR]
    RewriteCond %{REQUEST_URI} ^/wp-admin$
    RewriteRule ^(.*)$ - [R=403,L]
    </IfModule>
    and which one is better to use and why?
    Thanks

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    They are not all that similar. If both do what you want I would say the second is better because it doesn't redirect the user.

  • Users who have thanked Inigoesdr for this post:

    utnalove (08-30-2013)

  • #3
    Regular Coder
    Join Date
    Oct 2008
    Location
    Poland
    Posts
    382
    Thanks
    150
    Thanked 2 Times in 2 Posts
    to be sincere I don't know what they do. All I know is that they can protect from brute force attacks and automatic logins from robots that do not send a referrer.

    But I am not sure if these codes really do this.
    And I don't know what are the pros and cons of redirecting the users and where this user is redirected.

  • #4
    New Coder
    Join Date
    Dec 2013
    Posts
    26
    Thanks
    3
    Thanked 0 Times in 0 Posts
    The second one is not compleate,if you want to learn you can do it by yourself you just need :
    1- one server
    2- figure out what you want
    3- test the darny freaking code


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •