skip to Main Content

I need to edit my .htaccess file so that this string:

https://example.com/haathumb.php?var=400×300/src/wp-content/uploads/2017/08/brain-training-game-show-app-improves-memory.jpg

Is replaced with this replaced with this string:

https://example.com/thumb/400×300/src/wp-content/uploads/2017/08/brain-training-game-show-app-improves-memory.jpg

To sum up I need to replace haathumb.php?var= with thumb in a string using .htaccess. How do I do that?

2

Answers


  1. Chosen as BEST ANSWER

    I ended up using the .htaccess code below to make haathumb work correctly:

    # BEGIN haathumb rewrite
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^thumb/(.*) /haathumb.php?var=$1 [L]
    </IfModule>
    # END haathumb rewrite
    

  2. A redirect from haathumb.php?var=… to thumb/… then?

    RewriteEngine on
    
    RewriteCond %{QUERY_STRING} (?:^|&)var=([^&]+)
    RewriteRule ^haathumb.php$ /thumb/%1? [L,R=permanent]
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search