Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wordpress media full control over image uri/path

Tags:

wordpress

For a larger amount of images (approx 1k, plus same amount of thumbs, in ca 500 folders), we have the requirement that all image URIs used on the site have to have a SEO optimized path. They are already prepared and present with the complete path structures (each folder contains a thumbs folder with the same filename with smaller size/dimensions).

These are the URIs that we want to achieve:

Full size Image URI: http://myserver.com/img/de/cats/brown/jimmy.jpg

Thumb Image URI: http://myserver.com/img/de/cats/brown/thumbs/jimmy.jpg

  • They shall have an additional path, e.g. de/cats/brown in the examples above
  • They should start on the root of the domain, i.e. without the wp-content/uploads/ part of standard wordpress media files.

Simply put: we need full control over the image URIs, i.e. to have their own 'SEO-able' path structure and permalink.

I checked out several Gallery plugins (paid and free) but could not find any documentation on them for the above requirement.

Do you know of any plugin/theme to achieve and manage the URI structure described above?

like image 387
Volker Avatar asked Oct 21 '15 10:10

Volker


1 Answers

You can try to add these lines by placing them inside your functions.php file:

update_option('upload_url_path', '/wp-content/uploads');

This will make WordPress embed images like:

src="/wp-content/uploads/fileName.jpg" 

instead of

src="http://domainName.com/wp-content/uploads/fileName.jpg"

I hope this can help you to solve your problem.

like image 69
medo0070 Avatar answered Sep 23 '22 04:09

medo0070