Since there's a directory at /gallery/my-new-link
, the directory gets handled by mod_dir because it's missing the trailing slash. What mod_dir will try to do is redirect the request for a directory that's missing the trailing slash to the same request but with the trailing slash. This redirect is happening at the same time that mod_rewrite is rewriting the URI, and both get applied to the same request, resulting in a wonky redirect.
That means you'll need to turn off mod_dir, but that's kind of bad:
The DirectorySlash documentation says:
Turning off the trailing slash redirect may result in an information disclosure. Consider a situation where mod_autoindex is active (Options +Indexes) and DirectoryIndex is set to a valid resource (say, index.html) and there's no other special handler defined for that URL. In this case a request with a trailing slash would show the index.html file. But a request without trailing slash would list the directory contents.
So you'll need to turn off mod_dir while also attempting to do what mod_dir does by redirecting requests for directories missing the trailing slash to the same request with the trailing slash:
DirectorySlash Off
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.mysite.com [NC]
RewriteRule ^(.*)$ mysite.com/$1 [L,R=301] << http: has been deleted to post this message.
RewriteBase /
RewriteRule ^gallery/([^/]*)$ /gallery.php?page=$1 [L,NC,QSA]
RewriteRule ^venues/([a-zA-Z0-9-/]+)/$ /venues.php?page=$1 [L,NC,QSA]
# redirect with trailing slash for directories
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.*[^/])$ /$1/ [L,R]