Currently I am working on a WordPress website.
I have multiple websites on my webserver so my WordPress site is located at http://localhost/wordpress/
Now I want to have dynamic paths for my images.
As HTML for my logo I use
<img src="images/logo.png" />
And in my .htaccess
I use
RewriteRule ^images/(.*)$ wp-content/uploads/$1 [L]
This is only working on my homepage. When I go to the contact page http://localhost/wordpress/contact
I need to change my logo HTML to <img src="../images/logo.png" />
to have it working on the pages.
How can I point my htaccess record to the root so that I allways can use the path images/(.*)
?
I think I forget the RewriteCond
but I have tried some and nothing works, even some internal server errors appears.
How can I do this?
My complete .htaccess
looks like
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index.php$ - [L]
RewriteRule ^images/(.*)$ wp-content/uploads/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>
# END WordPress
Make sure to use absolute URLs for images which would always start with
/
And in your
DOCUMENT_ROOT/.htaccess
use same rule i.e.