URL rewrites and .htaccess
ptemples
Joined: 2008-08-12
Posts: 9 |
Posted: Thu, 2008-11-06 00:37 |
The following information is required to get an answer: I'm looking for a little help with mod_rewrite. I recently upgraded from an older version of Gallery to 1.5.9. The rewrite rules in .htaccess don't seem to cover this older URL generated by Gallery embedded inside of phpWebSite CMS (version 0.8.2): http://example.com/mod.php?set_albumName=albun84&mod=gallery&include=view_album.php This used to be a valid URL to an album named "albun84". I would have expected one of the Apache mod_rewrite rules to change this to something like: http://example.com/mod/gallery/albun84 but it doesn't. Instead, the browser is directed to the top-level Gallery menu, or http://example.com/mod/gallery (The URL is NOT rewritten in the browser address field.) I've taken several "stabs" at writing a rule to handle this URL, but none seem to work for me. Any ideas what sort of mod_rewrite rule might do the trick? At present, the .htaccess inside of the gallery directory looks like this: # BEGIN Gallery section Options -Indexes +FollowSymLinks RewriteCond %{REQUEST_FILENAME} !-d Thanks, Phil |
|
Posts: 3
I probably do not have the best answer, but if everything fails, this will help. You can always hardcode the rewrite rule, something like the following should work
RewriteRule ^albun84 /mod.php?set_albumName=albun84&mod=gallery&include=view_album.php [L,QSA]
---
http://www.maxi-pedia.com
Posts: 9
Thanks, xjessie007.
As it turns out, I found my answer on another web site forum. Handling the "?" is a little more involved and requires the RewriteCond %{QUERY_STRING} statement in conjunction. Here is the rule that worked for me:
RewriteEngine On
RewriteBase /
# Rewrite the older Gallery/phpWebSite URLs to the newer Gallery format
RewriteCond %{QUERY_STRING} ^set_albumName\=([^&]+)\&mod\=gallery\&include\=view_album.php.*$
RewriteRule ^mod.php$ /mod/gallery/%1? [R=301]
Thanks for taking a shot at it, though.
-Phil