I am using standard WordPress gallery, but I am not happy with the url to image (link to attachment page).
In my current situation gallery url is:
http://example.com/gallery/
and image url is
http://example.com/image01/
What I am trying to achieve is that gallery url will remain the same, but image (attachment) url will be:
http://example.com/gallery/image01/
I can customize my gallery code to add the gallery slug to attachment url (probably by creating custom shortcode which will get content of gallery shortcode and just replace urls), but I am not able to make .htaccess file to work (if is there better way then using .htaccess file, I don't mind that).
My current .htaccess code is
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /main/dmm/wp01/
# beginning of my code
RewriteRule ^selected-work/(.*)/ $1/
# end of my code
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /main/dmm/wp01/index.php [L]
</IfModule>
# END WordPress
# Caching disabled
<filesMatch "\.(html|htm|js|css)$">
FileETag None
<ifModule mod_headers.c>
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
</ifModule>
</filesMatch>
# END OF Caching disabled
/gallery/
prefix that you want/gallery/image1
, or is the word gallery representative of something, e.g/firstgallery/image1
/summer/image1
,/winter/image1
, or is there a page calledgallery
?/firstgallery/image1
/secondgallery/imagew2
and so on. I am pretty close to my solution using WP Rewrite API. I am going to post my answer as soon as I have it fully working.