Page 1 of 2 12 Last
  • Jump to page:
    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2018
    Posts
    65
    Rep Power
    1

    Redirect paths images .htaccess


    Hello
    I have this path of images that I want to redirect to this other path:

    FROM
    https://www.mysite.com/image.axd?pic...sapp-emoji.jpg

    TO
    https://www.mysite.com/wp-content/up...sapp-emoji.jpg

    Request is for my .htaccess file.

    Can you help me?
    Thank you
    Fabrizio
  2. #2
  3. Impoverished Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,789
    Rep Power
    9646
    Which URL do you want people to see in their browser?
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2018
    Posts
    65
    Rep Power
    1
    second URL
  6. #4
  7. Impoverished Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,789
    Rep Power
    9646
    Then the RewriteRule should mention /wp-content/uploads and capture what's after, then rewrite onto /image.axd.

    What have you tried so far and how has it not worked out?
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2018
    Posts
    65
    Rep Power
    1
    this but dont work
    RewriteCond %{QUERY_STRING} picture=([^&]+) [NC]
    RewriteRule ^image\.axd$ /wp-content/uploads/upload/%1? [L,NC,NE,R=301]
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2018
    Posts
    65
    Rep Power
    1
    secondo URL is for uset
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2018
    Posts
    65
    Rep Power
    1
    user
  14. #8
  15. Impoverished Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,789
    Rep Power
    9646
    Code:
    RewriteRule FROM TO
    People see the "FROM" URL and the server transforms it into "TO".

    So if you want people to see the /wp-content URL then that's the FROM and the image.axd is the TO.
    Code:
    RewriteRule ^wp-content/uploads/upload/(.*) image.axd?picture=$1 [L]
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2018
    Posts
    65
    Rep Power
    1
    No requinix opposed... When i write in address bar of my browser this URL https://www.mysite.it/image.axd?pict...dio-hayden.jpg must redirect to this URL https://www.mysite.it/wp-content/upl...dio-hayden.jpg

    I tried to change your code like that, but it does not make any redirects... it's right?

    RewriteRule ^image.axd?picture=$ /wp-content/uploads/upload/$1 [L,R=301]
  18. #10
  19. Impoverished Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,789
    Rep Power
    9646
    So actually redirect redirect. I assumed you meant rewrite.

    Code:
    RewriteCond %{QUERY_STRING} picture=([^&]+) [NC]
    RewriteRule ^image\.axd$ /wp-content/uploads/upload/%1? [L,NC,NE,R=301]
    Seems fine. Sure it wasn't working? Were there any RewriteConds before it, like I said in your other thread might happen if you commented out just a RewriteRule?
  20. #11
  21. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2018
    Posts
    65
    Rep Power
    1
    this is my htaccess, that you have modified ...I put code after cpanel and well-know but don't make redirect ... I don't know why... perphaps is fault of plugin??

    Code:
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    
    RewriteRule ^[0-9]+\..+\.cpaneldcv$ - [L]
    RewriteRule ^\.well-known/acme-challenge/[0-9a-zA-Z_-]+$ - [L]
    RewriteRule ^\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$ - [L]
    
    RewriteCond %{QUERY_STRING} picture=([^&]+) [NC]
    RewriteRule ^image\.axd$ /wp-content/uploads/upload/%1? [L,NC,NE,R=301]
    
    RewriteRule ^images/(.+?)(?:\.jpgx)?$ /wp-content/uploads/upload/$1 [L,NC,NE,R=301]
    RewriteRule ^\d{4}/\d\d/(default) /$1 [R=301,L]
    
    # RewriteCond %{QUERY_STRING} .
    # RewriteCond %{QUERY_STRING} !^item= 
    # RewriteCond %{REQUEST_URI} !^/manage
    # RewriteRule .? https://www.mysite.it/%{REQUEST_URI}? [R=301,L] 
    
    RewriteRule ^(.*).aspx$ https://www.mysite.it/$1 [R=301,L]
    RewriteRule ^.*post/\d{4}/\d{2}/\d{2}/(.*) /$1/ [R=301,L]
    RewriteRule ^\d{4}/\d{2}/\d{2}/(.*) /$1/ [R=301,L]
    RewriteRule ^[Bb]log[Ee]ngine/post/(.*) /$1/ [R=301,L]
    RewriteRule ^post/(.*) /$1/ [R=301,L] 
    RewriteRule ^index\.php$ - [L]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    I
  22. #12
  23. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2018
    Posts
    65
    Rep Power
    1
    This for example works perfectly

    RewriteRule ^images/(.+?)(?:\.jpgx)?$ /wp-content/uploads/upload/$1 [L,NC,NE,R=301]

    https://www.mysite.it/IMAGES/2016/10...ve-23.jpg.jpgx

    https://www.mysite.it/wp-content/upl...iuntive-23.jpg
  24. #13
  25. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2018
    Posts
    65
    Rep Power
    1
    deactivated plugin don't work the same :-(

    What can it be?
  26. #14
  27. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2018
    Posts
    65
    Rep Power
    1
    I remove also all redirect in htaccess... nothing don't work..
    how to understand what depends on?
  28. #15
  29. Impoverished Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,789
    Rep Power
    9646
    I don't know. What if you try
    Code:
    # RewriteCond %{QUERY_STRING} picture=([^&]+) [NC]
    # RewriteRule ^image\.axd$ /wp-content/uploads/upload/%1? [L,NC,NE,R=301]
    RewriteRule ^image\.axd$ / [L,R=301]
Page 1 of 2 12 Last
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo