By default Gallery uses web URLs which have question marks and lots of numbers in them which looks ugly. e.g. http://example.com/?g2_itemId=123
The URL Rewrite plugin enables you to configure URL patterns to more human readable.
To install the URL Rewrite plugin, go to Gallery Admin and click on the “Plugins” link to display the plugins already installed, and then the “Get More Plugins” tab. To display an available list of plugins which can be installed.
If this is your first visit, you’ll need to download the list of plugins first. When the list of plugins are displayed, go to the “Gallery” section and click the “download” link associated with “URL Rewrite” plugin.
When the plugin has been installed a status message “URL Rewrite plugin updated” will appear. Click on “Plugins” link again to see your installed plugins, the “URL Rewrite” plugin will appear in the “Gallery” section with a “disabled” status. Click on the “Configure” link to begin setting up the URL Rewrite plugin.
There are two types of methods which can be used for the URL Rewrite plugin, Apache mod_rewrite or PHP Path Info. The difference is mod_rewrite will give you pretty links e.g. http://example.com/album-name, and PHP Path Info will give you almost pretty links e.g. http://example.com/main.php/album-name. I setup my URL Rewrite plugin with mod_rewrite
Before you select the Apache mod_rewrite method it must be enable first. In Ubuntu run execute the following:
$ sudo a2enmod rewrite
In the Apache configuration file, the FollowSymLinks option needs to be enabled and the FileInfo needs to be allowed for the Gallery’s home directory.
<Directory /var/www/gallery>
Options FollowSymLinks
AllowOverride FileInfo
allow from all
</Directory>
Then create a file in your Gallery directory named .htaccess and give it read/write permission.
$ cd /var/www/gallery $ touch .htaccess $ chmod 666 .htaccess
After click on the “Apache mod_rewrite” link to continue the URL Rewrite Administration setup with mod_rewrite, and click on the “Save” button when you are satisfy with the URL rewrite rules.

For better security it’s recommended to remove write permission on the .htaccess
$ chmod 644 .htaccess
For more information refer to the Gallery2 Module Rewrite page.
Related posts:



