0

When working on a project, I would like to use the online images, so I don't have to download e.g. all images (as described here).

To achieve this, I wrote a view lines in my .htaccess-file:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{SERVER_PORT} 8890
RewriteRule ^wp/media/.+    https://www.example.com:443%{REQUEST_URI}

</IfModule>

According to htaccess.madewithlove.be this should convert an image url from:

https://example.localhost:8890/wp/media/27442.jpg

to:

https://www.example.com/wp/media/27442.jpg

Context:

  • MacBook Pro
  • OS X Catalina 10.15.2
  • MAMP Pro 5.5.1
  • WordPress 5.3.2
  • example.localhost:8890 (SSL) up and running
  • local website is working fine

What I already tried/verified/adjusted:

Am I missing something? What else could prevent this from working?

uruk
  • 1,094
  • 2
  • 14
  • 26
  • How exactly is it not working? Does the redirect not happen at all, does it go to a wrong URL, do you get errors … – 04FS Jan 13 '20 at 11:54

1 Answers1

0

The problem was that I had another .htaccess-file inside the wp-folder, because I moved the WordPress installation into its own directory (see here). When moving the rules into this inner .htaccess-file, it started working immediately.

uruk
  • 1,094
  • 2
  • 14
  • 26