SEF URLs for Images

By default JoomGallery doesn't use the real path of images for their URLs, but a generic one which identifies an image with its ID. This has several advantages like the possibility to count the views on images and to be able to move images around after uploading without having to adapt all the pages where the image was already published.

Unfortunately, there is a disadvantage, too: The image URLs aren't very good for SEO anymore and they don't end on a valid image file extension like .jpg.

One possibility to solve that problem is to enable option 'Use real paths' in tab 'General Settings' -> 'Paths and directories' of the configuration manager, but with that you will lose all the advantages of the generic URLs. Additionally it has to be noted that this change cannot be applied in all situations. For example, when inserting images into articles with the help of the content plugin JoomPlu still the generic URLs will be used due to technical reasons.

The good news is that you can still enable good SEF URLs for images in JoomGallery by using the core SEF of Joomla! (the following won't work if you are using a third party SEF extension).

  1. You have to ensure that you are using the core SEF with having 'Use URL rewriting' and 'Adds Suffix to URL' enabled.
  2. Go to control panel of JoomGallery and click on the 'Options' button in the toolbar. In the 'SEO Settings' tab enable the SEF URLs for images.
  3. Depending on whether you are using a '.htaccess' or a 'web.config' file in your Joomla! root directory do the following change:

.htaccess

Search the following line in your '.htaccess' file

RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC]

and add the 'jpg' file extension to the list of allowed extensions so that it looks like that:

RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw|jpg))$ [NC]

web.config

Search the following line in your '.htaccess' file

<add input="{URL}" pattern="/component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$" />

and add the 'jpg' file extension to the list of allowed extensions so that it looks like that:

<add input="{URL}" pattern="/component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw|jpg))$" />

If you have any questions about that feel free to visit our forum.

SEF URLs for images are available in JoomGallery starting with version 3.1 (there are workarounds for versions 2.5 and 3.0 in our forum).

Joomla!®

Joom::Gallery is not affiliated with or endorsed by the Joomla! Project or Open Source Matters. The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.