Help with htaccess and rewrite rules
designbysue
Joined: 2005-04-12
Posts: 81 |
Posted: Sat, 2010-03-06 03:16 |
After much frustration caused by some weirdness on my server I have installed Gallery 2 and migrated over 5000 images to it from my g1 folder. I am now trying to figure out what the following means. Quote:
Edit or create a file called .htaccess in your Gallery1 directory and add the text shown below to the file. Remove G1 rewrite rules from an existing file. Redirects will also work in your Gallery2 directory if G2 is installed in the path where G1 used to be. However, if you also use the G2 URL Rewrite module then activate the G1 redirect rule in that module instead of using the block shown below. My Gallery 2 is in the same location (/gallery/) and my Gallery 1 install was. 1. Am I to replace the all of the current info in the htaccess with the code shown? The current info is Quote:
# BEGIN Gallery section 2. What does this mean? "Remove G1 rewrite rules from an existing file. " 3. Where is the G1 redirect rule and how do I activate it? 4. And it looks like I am not to change the htaccess if I activate the redirect rule - correct? 5. And totally what does this mean? "Add the same .htaccess block in the Gallery1 albums directory if you also wish to redirect links to image files and album directories. Note that these redirects are not active until the G1 images are actually removed or moved. Omit the !-f line shown below to redirect anyway" I appreciate any assistance in this because I would like the links already in google and other search engines to get the visitor to the same location as it was in Gallery 1 and I'm guessing these are the steps necessary to accomplish this. I searched but can't find anything about G1 redirect rules except exact quotes of the instructions. Thanks Edited - I have been working on this since this post and realized I should give the problem too (duh) When one goes to an old link, the browser window is blank. I followed the directions found here http://codex.gallery2.org/Gallery2:migration#Migrating_from_Gallery_1_to_Gallery_2 and originally had gallery 1 in the folder "gallery" - then in the migration switched it to "g1" as instructed. Hope someone can help me with this final step in this migration. |
|
Posts: 27300
Sorry I don't know much about .htaccess and other cool rewrite magic.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 81
Thank you Dave - someone out there must know about this - Please how do I make the migration from 1 to 2 successful where the G1 to G2 mapping works. I did the migration correctly and the mapping has been preserved. The site is www.designbysue.com/gallery.
Sue
Posts: 16504
Have you followed these steps?
http://codex.gallery2.org/Gallery2:migration#Enable_the_G1-.3EG2_URL_Rewrite_Rule
Where exactly are you stumbling?
I'm not sure where you're seeing that, but if it's G2, Site Admin > URL Rewrite
That's referring to these steps in the link I posted above:
There is an .htaccess file you need to manually create and edit. It's in your G1 albums/ directory. If you've moved your G1 install or the directory where your albums directory was, all you need to do is create a new directory named albums in the same spot it was located before. Then put the .htaccess file with the contents that the G1 migration tool told you to make in there.
You don't need to edit the .htaccess for G2, as that's done through the URL Rewrite settings page under Site Admin
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 81
The steps I am quoting are those shown on the migrate plug in. I have also referenced the link you posted. I followed the directions at the post for the transfer -including the creation of g1 to hold the original Gallery 1 and installing Gallery 2 in the same directory as Gallery 1 was in (ie gallery). I have Url rewrite configured as instructed and I have tried to put the htaccess code in any possible combination of places and now of the links to the old album go to the new. I don't understand how this works and maybe that would help. But trying to put the htaccess file anywhere in the g1 folder doesn't make sense as now of the existing links point to that folder - it was only created as temporary measure to upgrade. The links point to the current directory (gallery) So in reading your post I figured it would make sense to put it in a folder called albums in the gallery folder, so I just tried that and again no success.
If you go to http://www.google.com/search?hl=en&client=safari&rls=en&q=+site:designbysue.com+design+by+sue+gallery&ei=5PKTS67HIomXtgf2psTUCg&sa=X&oi=nshc&resnum=1&ct=more-results&ved=0CAoQ2AQ you will get a long list of the links I am hoping to make work.
The gallery is now at www.designbysue.com/gallery
The htaccess at that location has the following:
# BEGIN Url Rewrite section
# (Automatically generated. Do not edit this section)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /gallery/
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} gallery\_remote2\.php
RewriteCond %{REQUEST_URI} !/gallery/main\.php$
RewriteRule . - [L]
RewriteCond %{THE_REQUEST} /gallery/d/([0-9]+)-([0-9]+)/([^/?]+)(\?.|\ .)
RewriteCond %{REQUEST_URI} !/gallery/main\.php$
RewriteRule . /gallery/main.php?g2_view=core.DownloadItem&g2_itemId=%1&g2_serialNumber=%2&g2_fileName=%3 [QSA,L]
RewriteCond %{THE_REQUEST} /gallery/v/([^?]+)(\?.|\ .)
RewriteCond %{REQUEST_URI} !/gallery/main\.php$
RewriteRule . /gallery/main.php?g2_path=%1 [QSA,L]
RewriteCond %{THE_REQUEST} /gallery/([^?]+)(\?.|\ .)
RewriteCond %{REQUEST_URI} !/gallery/main\.php$
RewriteRule . /gallery/main.php?g2_controller=migrate.Redirect&g2_path=%1 [QSA,L]
</IfModule>
# END Url Rewrite section
# BEGIN Url Rewrite section
# (Automatically generated. Do not edit this section)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /gallery/
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} gallery\_remote2\.php
RewriteCond %{REQUEST_URI} !/gallery/main\.php$
RewriteRule . - [L]
RewriteCond %{THE_REQUEST} /gallery/d/([0-9]+)-([0-9]+)/([^/?]+)(\?.|\ .)
RewriteCond %{REQUEST_URI} !/gallery/main\.php$
RewriteRule . /gallery/main.php?g2_view=core.DownloadItem&g2_itemId=%1&g2_serialNumber=%2&g2_fileName=%3 [QSA,L]
RewriteCond %{THE_REQUEST} /gallery/v/([^?]+)(\?.|\ .)
RewriteCond %{REQUEST_URI} !/gallery/main\.php$
RewriteRule . /gallery/main.php?g2_path=%1 [QSA,L]
</IfModule>
<FilesMatch "\.(php|html?)$">
php_value memory_limit 164M
</FilesMatch>
# END Url Rewrite section
I doubt if this should be replaced.
Thanks for your stab at helping
Sue
Posts: 4342
Your google link lists lots of webpages like
www.designbysue.com/glassgallery/view_album.php?....
I don't know much about G1-G2 migration, but shouldn't there be two different sets of .htaccess rules? I can see that you'd need one set of rules in .htaccess in the old g1 albums directory for g1 rewritten urls, but for native urls (../view_album.php?...) of the format listed in your google link (I'm guessing you weren't using G1 rewrite) there should be another set of rules that will need to go in the .htaccess file in the old g1 root directory. Which, since you've put g2 in the same directory, means they'll have to go in the same .htaccess file as the automatically-written g2 rewrite rules.
On that subject, you appear to have two sets of the same rewrite rules. I think you can probably delete the second set without harm (the first set has more entries.)
The migration instructions do refer to "Add New .htaccess Files in Your Gallery 1 and Gallery 1 albums Folder" implying there's a file to go in both the G1 folder and in the G1 albums folder.
There... I guess that's the set of lines to add to the .htaccess in the old G1 directory. However you've made life difficult for yourself by putting G2 in the same directory as G1 used to be, so you'll have to mix those rules into the .htaccess file already created by G2's rewrite module.
Posts: 81
As stated I followed the instructions exactly as were on the Gallery website.
Again I did this according to the Gallery website so how could this have made it more difficult if the instructions are written for this method.
Is there anyone who does know about this migration. I did this exactly as instructed in the link referred to earlier. I have tried putting the exact htaccess files where instructed and I have enabled the plug ins as instructed. There must be one step that I am not seeing.
thanks
Sue
Posts: 27300
I have never installed G2 in the same directory as G1 and I don't think the migration directions where written with this case in mind, but I could be wrong. It has been soo long since I looked at this.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 81
If that is not what they meant they were specifically written incorrectly! Line 7 of the instructions states
I don't see how I could have interpreted that in any other way
Sue
The instructions are here http://codex.gallery2.org/Gallery2:migration#Migrating_from_Gallery_1_to_Gallery_2
Posts: 27300
I guess I am wrong.
Sorry
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 16504
Sue, have you put the the Rewrite Rules and .htaccess file in your albums directory?
Would it be possible for you to give me FTP or SSH access and also admin login access to your G2 install? If so just PM me by clicking Write to author.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 81
I sent you a pm - thanks!
Sue
Posts: 16504
o.k. I made a few minor changes, but I don't have any of your old G1 URLs so I didn't have anything to test. Post or PM what one of those would have been or test them and see if things are redirecting now.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 81
Now I get broken link instead of the blank page that was coming up before - I'm not sure but I think it was closer before (?)
here are some of the old links
http://www.designbysue.com/gallery/view_album.php?set_albumName=bannermans1
http://www.designbysue.com/gallery/view_album.php?set_albumName=album40
http://www.designbysue.com/gallery/view_album.php?set_albumName=album30
Sue