I want to rename an album (the part in the url, not just the text) but don't want all my old links to break...
WebKat
Joined: 2002-11-22
Posts: 182 |
Posted: Sat, 2012-04-07 22:00 |
I have an album that started out as mostly Ink, but I put paintings in there as well (I had very few paintings at the time)... since then it's become 99% paintings and it looks ridiculous for the url to say "Ink" instead of "Paintings"... so I'd like to change it, but if I do, all my old links to the gallery will break. Is there a mod_rewrite trick I can do so that links that point to the "Ink" folder (I know it's not REALLY a folder) will redirect to the "Paintings" folder? Here is the actual album in question: http://gallery2.opalcat.com/gallery2/v/Art/Ink/ I'd like it to be http://gallery2.opalcat.com/gallery2/v/Art/Paintings/
|
|
Posts: 1642
Apache:
RewriteCond %{THE_REQUEST} /gallery2/v/Art/Ink(/?)
RewriteCond %{REQUEST_URI} !/gallery2/main\.php$
RewriteRule . /gallery2/v/Art/Paintings/ [QSA,L]
Nginx:
rewrite ^/gallery2/v/Art/Ink(/?) /gallery2/v/Art/Paintings/ last;
--
dakanji.com
Posts: 182
Ok where would I put that in this .htaccess file? And then would I go ahead and rename the folder?
Thanks for your help!
--
WebKat, Gallery2 holdover extraordinaire.
Posts: 1642
Notes:
1. The line has been ended with ([QSA] and not [QSA,L] which should be more efficient here. Test this first (I don't use Apache so I can't). If it doesn't work, change to [QSA,L]
2. If you reset the rewrite module, the htaccess will be over written. So back it up ... "htaccess.bak" is a good name
--
dakanji.com
Posts: 182
I tried it the first way, and got this:
Then I changed it to [QSA,L] and now it gives a 500 server error:
--
WebKat, Gallery2 holdover extraordinaire.
Posts: 182
(I changed it back and re-renamed it back to Ink for now just so it's working.)
--
WebKat, Gallery2 holdover extraordinaire.
Posts: 182
One more thing, since you seem to know your .htaccess stuff... perhaps you can help me with this other thing: http://gallery.menalto.com/node/105969 --I upgraded from G1>G2 several years ago, but didn't complete the mapping process so that my old links would work and redirect to the new install. Now, I checked the database and the migration map info is there... but I don't know what to put in the .htaccess file to make it work. Any ideas? The specific info is in that other thread.
--
WebKat, Gallery2 holdover extraordinaire.
Posts: 1642
Try this instead in the same location
RewriteCond %{THE_REQUEST} /gallery2/v/Art/Ink/
RewriteCond %{REQUEST_URI} !/gallery2/main\.php$
RewriteRule . /gallery2/main.php?g2_path=Art/Paintings [QSA,L]
I'll have a look at the other post.
--
dakanji.com
Posts: 182
That worked! :D Thank you so much!
--
WebKat, Gallery2 holdover extraordinaire.