Gallery2 and SEO - Tips and suggestions
netscan
Joined: 2005-07-16
Posts: 39 |
![]() |
ichthyous wrote:
If you've hand edited the class files and it works, cool, but updating gallery will be a pain because you will pretty much have to do it all over. Using main.php as the default works just as good and you won't have to worry about upgrades mucking it up. |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
i guess a simple way to get rid of main.php / index.php is: - set your webserver's directory index to main.php (Apache DirectoryIndex main.php index.php index.html index.htm) didn't test this, but i guess it should work. ------ and yes, you need to delete index.php and rename main.php to index.php after each g2 upgrade. but that's about it. -------------- |
|
dmc43
Joined: 2005-02-16
Posts: 59 |
![]() |
"i guess a simple way to get rid of main.php / index.php is: - set your webserver's directory index to main.php (Apache DirectoryIndex main.php index.php index.html index.htm) didn't test this, but i guess it should work. Thanks valiant, that works for me. No index.php or main.php when navigating site. Thanks again |
|
sambritt
![]()
Joined: 2007-04-14
Posts: 28 |
![]() |
"i guess a simple way to get rid of main.php / index.php is: - set your webserver's directory index to main.php (Apache DirectoryIndex main.php index.php index.html index.htm) didn't test this, but i guess it should work. ~~@~~@~~ when you are talking about the webserver's directory index, are you also talking about the .htaccess file? |
|
sambritt
![]()
Joined: 2007-04-14
Posts: 28 |
![]() |
or you may be talking about a redirect? |
|
Dayo
Joined: 2005-11-04
Posts: 1642 |
![]() |
sambritt |
|
sambritt
![]()
Joined: 2007-04-14
Posts: 28 |
![]() |
is there any other way to get completely rid of the /main.php in the URL as well as the /index.php? thank you |
|
netscan
Joined: 2005-07-16
Posts: 39 |
![]() |
sambritt wrote:
is there any other way to get completely rid of the /main.php in the URL as well as the /index.php? Have you tried the suggetions above? |
|
sambritt
![]()
Joined: 2007-04-14
Posts: 28 |
![]() |
No because there is only one way mentioned to completly get rid of it vs. just changing the main.php to index.php. this main.php pointing needs to be an easy type thing to change in the admin panel. Updating from the G1 to the G2 is an easy process to conquer, BUT i hate the fact that all my SEO URL's are now wasted and gone that have been pointing from other 3rd parties web sites going on 3-4 years now. This is a NightMare for an SEO/Internet Marketing Freak like me. Next time I will install this on another URL and I guess I should have known better to begin with. My permnalinks are all showing in the G2 Admin panel, but cant figure out the .htaccess file to work properly. this main.php file in the URL is driving me crazy to look at and I cant get rid of it... |
|
netscan
Joined: 2005-07-16
Posts: 39 |
![]() |
Ok, let me break it down a bit here so I can follow where exacty you are You do not have the ability to add main.php to the DirectoryIndex directive in httpd.conf, right? Assuming the above is true, have you tried adding $gallery->setConfig('baseUri', '/'); to config.php and renaming main.php to index.php? |
|
sambritt
![]()
Joined: 2007-04-14
Posts: 28 |
![]() |
Yes, I'm assuming that I do not have the ability to add main.php to the DirectoryIndex directive in httpd.conf. I'm on a shared hosting with startlogic and now I have tried adding, $gallery->setConfig('baseUri', '/'); to config.php and renaming main.php to index.php. the URL is good but the theme is not working now, so now I'll log on the admin and try changing themes to see if that works. thank you very much for your support netscan... |
|
sambritt
![]()
Joined: 2007-04-14
Posts: 28 |
![]() |
hmmm, now when i click on the log on link, it goes to my home index page. In fact all my links now are just going to the home index page, one up from the sub directory of the gallery location. |
|
netscan
Joined: 2005-07-16
Posts: 39 |
![]() |
set the baseUir in config.php to your gallery root directory ie: if it's http:://yoursite.com/gallery/ == $gallery->setConfig('baseUri', '/gallery/'); |
|
sambritt
![]()
Joined: 2007-04-14
Posts: 28 |
![]() |
it seems to like the code a little better of: $gallery->setConfig('baseUri', ''); but not @ 100% as the images are not showing @ all thanks again for your support, SB |
|
netscan
Joined: 2005-07-16
Posts: 39 |
![]() |
It's not showing images because it's looking in the wrong place - right click on one and grab the properties and you'll see what I mean. You have to set the baseUri to the correct location (the folder where gallery resides) / == yoursite.com/ |
|
sambritt
![]()
Joined: 2007-04-14
Posts: 28 |
![]() |
Thank You, Thank You, Thank You, your the best netscan!!! it works, the example above will totally delete the main.php in the URL and not replace it with the index.php in the URL. thank you for your patience here... ~~@~~@~~ may i ask another question about the URL coding here, or should i go somewhere else? |
|
sambritt
![]()
Joined: 2007-04-14
Posts: 28 |
![]() |
everyting still works but now when i click on either the site admin or your album links, they go to an error page. also all the links to any of the image galleries are not working. can you please explain? thank you. |
|
netscan
Joined: 2005-07-16
Posts: 39 |
![]() |
Check .htaccess, see if any of the rules are pointing to main.php |
|
sambritt
![]()
Joined: 2007-04-14
Posts: 28 |
![]() |
do you have a code for the .htaccess as now it says # BEGIN Url Rewrite section # The path to your Gallery (in this case example.com/gallery2/) RewriteRule ^admin /gallery2/main.php?g2_view=core.SiteAdmin [QSA,L] |
|
netscan
Joined: 2005-07-16
Posts: 39 |
![]() |
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d [OR] RewriteCond %{REQUEST_FILENAME} gallery\_remote2\.php RewriteCond %{REQUEST_FILENAME} !/main\.php$ RewriteRule . - [L] RewriteCond %{QUERY_STRING} view=core.DownloadItem RewriteCond %{QUERY_STRING} itemId=([0-9]+) RewriteCond %{HTTP_REFERER} !://yoursite.com/ [NC] RewriteCond %{HTTP_REFERER} !^$ RewriteRule . /main.php?g2_view=watermark.DownloadItem&g2_itemId=%1 [L] RewriteCond %{THE_REQUEST} \ /updates/(\?.|\ .) RewriteCond %{REQUEST_FILENAME} !/main\.php$ RewriteRule . /main.php?g2_view=updates.ShowUpdates [QSA,L] RewriteCond %{THE_REQUEST} \ /Key-Word/view/([0-9]+).html(\?.|\ .) RewriteCond %{REQUEST_FILENAME} !/main\.php$ RewriteRule . /main.php?g2_view=comment.ShowAllComments&g2_itemId=%1 [QSA,L] RewriteCond %{THE_REQUEST} \ /Key-Word/add/([0-9]+).html(\?.|\ .) RewriteCond %{REQUEST_FILENAME} !/main\.php$ RewriteRule . /main.php?g2_view=comment.AddComment&g2_itemId=%1 [QSA,L] RewriteCond %{THE_REQUEST} \ /Key-Word/([0-9]+)-([0-9]+)/([^\/\?]+)(\?.|\ .) RewriteCond %{REQUEST_FILENAME} !/main\.php$ RewriteRule . /main.php?g2_view=core.DownloadItem&g2_itemId=%1&g2_serialNumber=%2&g2_fileName=%3 [QSA,L] RewriteCond %{THE_REQUEST} \ /Key-Word/([^?]+)(\?.|\ .) RewriteCond %{REQUEST_FILENAME} !/main\.php$ RewriteRule . /main.php?g2_view=core.ShowItem&g2_path=%1 [QSA,L] RewriteCond %{THE_REQUEST} \ /([^?]+)(\?.|\ .) RewriteCond %{REQUEST_FILENAME} !/main\.php$ RewriteRule . /main.php?g2_view=rewrite.FileNotFound [QSA,L] </IfModule> I have my server set to display main.php as an index page though. What you can do is change your's to read index.php instead of main.php but I don't know how it will affect gallery since they made main.php hard coded in a lot of crap (they might have changed that too though since last I checked), you will at least be able to get in and configure the rewrite module correctly. |
|
sambritt
![]()
Joined: 2007-04-14
Posts: 28 |
![]() |
nnaaawww, since i have used this gellery installer of about 1000 times it seems like, (thank god it keeps using the same sql tables) i am in frY mode with this... this G2 has completly ~!@#$% my URL database and four years worth of links pointing. I actually have page ranks on some of these URL's and WHAM!!!, they are worthless in amount of seconds, that took years to development. Now my webmasters account with Google is Smoking with issues!!!!! you have to be completly MAD !!!! not to think of this !!!! DO NOT UNDER ANY CIRCUMSTANCES UPDATE FROM G1 TO THE G2 IF YOU HAVE URLs POINTING TO YOUR WEB SITE. UNLESS YOUR An .HTACCESS GURU AND YOUR NOT A NOVICE LIKE I AM..... did you know WordPress automatically gives you the .htaccess codes in their PERMALINKS Section?????? i want to put the G1 back and install G2 on another directory. maybe i can task this one in 30 days, like it has taking me hours of beyond reason by now. |
|
netscan
Joined: 2005-07-16
Posts: 39 |
![]() |
I'm pretty sure G2 has a rewrite rule built into the module for G1 installs, prolly take awhile to make sure it's exactly right. And for the love of god man - work on a copy of your gallery until you get it straight before taking it live. |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
netscan thanks for supporting sambritt and many other users! sambritt as jojotop points out, you can rename main.php to index.php, but you have to tell g2 about it by changing the GALLERY_MAIN_PHP constant as explained in the FAQ entry linked above. Additionally, set your baseUri in config.php to /gallery/ (the value you guys determined above) and you should be all set. > DO NOT UNDER ANY CIRCUMSTANCES UPDATE FROM G1 TO THE G2 IF YOU HAVE URLs POINTING TO YOUR WEB SITE. I understand your frustration but G1 URLs still work in G2 if you follow the instructions. All G1 image and photo/album page urls are redirected (permanentely) to G2. -------------- |
|
Edi2
![]()
Joined: 2007-04-27
Posts: 8 |
![]() |
Thanks to netscan for this useful post. I installed for the first time gallery on my site and trying to apply this : Open modules/core/templates/blocks/BreadCrumb.tpl Remove arg3="highlightId=`$theme.parents[parent.index_next].id`" and Remove "arg3="highlightId=`$theme.item.id`" However, in my BreadCrumb.tpl file I can not find these lines |
|
dichev
![]()
Joined: 2007-05-25
Posts: 15 |
![]() |
Edi2 wrote:
I installed for the first time gallery on my site and trying to apply this : So do I... |
|
nivekiam
![]()
Joined: 2002-12-10
Posts: 16504 |
![]() |
Those lines of code were taken out of BreadCrumb.tpl on August 1st, 2006. Read through this post, http://gallery.menalto.com/node/54753 This appears to be what you're looking for. Bharat also points out some of the functionality you loose by doing this. ____________________________________________ |
|
dichev
![]()
Joined: 2007-05-25
Posts: 15 |
![]() |
Thanks, nivekiam! I see... I have have fixed this, but forgot to write it here. I think it was in: modules/core/classes/GalleryUrlGenerator.class So I have modified also: modules/core/templates/blocks/BreadCrumb.tpl I've made some tune to the carbon template, some links become rel="nofollow" and now everything seems to work how I've wanted: Hope it's enough SE friendly now. If somebody is interested in details I can explain it when I find some time. Thanks again and good luck to everybody. |
|
nivekiam
![]()
Joined: 2002-12-10
Posts: 16504 |
![]() |
Again, just be aware that you loose some functionality and usability with this modification, so you have to decide is being slightly more SE friendly is worth making your gallery harder to navigate around in. Also, for those reading this thread, please read the entire thread here http://gallery.menalto.com/node/54753 that explains what to edit. I'm with ichthyous here that Google is smart enough to not be effected by what appears to be "duplicate" content. I've had some Ubuntu screenshots on my Gallery for a long time now, using Gallery just as it is out of the box with little to no modification: I don't see where google thinks anything there is duplicate content. |
|
dichev
![]()
Joined: 2007-05-25
Posts: 15 |
![]() |
You have the right, nivekiam. I have read that some of the functionality will be lost and I see that in multipage albums the gallery will be less user friendly. |
|
dichev
![]()
Joined: 2007-05-25
Posts: 15 |
![]() |
nivekiam, dichev.com/gallery/albums/kavala/?g2_highlightId=101 404 (Not found) [?] May 26, 2007 p.s. - I've removed the http-prefix, not to spam the forums with links. ----- |
|
honvl
Joined: 2007-04-26
Posts: 17 |
![]() |
User-agent: * User-agent: Googlebot I recently had my main gallery pages go supplemental in Google's index, so I am blocking all dynamically generated pages with this robots.txt code. |
|
Dayo
Joined: 2005-11-04
Posts: 1642 |
![]() |
honvl wrote:
That is extreme and will not solve your issue. You need to block selected urls. Slideshow for instance can be a problem. User-Agent: * Browse thorugh your site and pick pages you don't mean GBot to index and paste wildcard versions of the links to your robots file. I just wanted mine to focus on the images and nothing more. |
|
honvl
Joined: 2007-04-26
Posts: 17 |
![]() |
You are right, it was extreme. Gallery appended dynamic data to the Googlebot session, and as a result even non-dynamic photo pages were cleared off the Google index. I am going to try this configuration in my robots file. User-agent: * |
|
cimbus
Joined: 2007-07-02
Posts: 11 |
![]() |
DUPLICATE CONTENT (photo resize) ROBOTS |
|
Richard King
Joined: 2007-07-08
Posts: 24 |
![]() |
There is a much easier way to improve SEO Use gallery as part of a text rich website, not as the whole website! |
|
dichev
![]()
Joined: 2007-05-25
Posts: 15 |
![]() |
Yes, it is very good idea to use G2 as a part of a website, so do I, but Gallery2 is advanced enough to handle rich text content to every image or album page. It is a personal decision how to build your website architecture and depends to the individual code & content writing skills. |
|
sambritt
![]()
Joined: 2007-04-14
Posts: 28 |
![]() |
netscan wrote:
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d [OR] RewriteCond %{REQUEST_FILENAME} gallery\_remote2\.php RewriteCond %{REQUEST_FILENAME} !/main\.php$ RewriteRule . - [L] RewriteCond %{QUERY_STRING} view=core.DownloadItem RewriteCond %{QUERY_STRING} itemId=([0-9]+) RewriteCond %{HTTP_REFERER} !://yoursite.com/ [NC] RewriteCond %{HTTP_REFERER} !^$ RewriteRule . /main.php?g2_view=watermark.DownloadItem&g2_itemId=%1 [L] RewriteCond %{THE_REQUEST} \ /updates/(\?.|\ .) RewriteCond %{REQUEST_FILENAME} !/main\.php$ RewriteRule . /main.php?g2_view=updates.ShowUpdates [QSA,L] RewriteCond %{THE_REQUEST} \ /Key-Word/view/([0-9]+).html(\?.|\ .) RewriteCond %{REQUEST_FILENAME} !/main\.php$ RewriteRule . /main.php?g2_view=comment.ShowAllComments&g2_itemId=%1 [QSA,L] RewriteCond %{THE_REQUEST} \ /Key-Word/add/([0-9]+).html(\?.|\ .) RewriteCond %{REQUEST_FILENAME} !/main\.php$ RewriteRule . /main.php?g2_view=comment.AddComment&g2_itemId=%1 [QSA,L] RewriteCond %{THE_REQUEST} \ /Key-Word/([0-9]+)-([0-9]+)/([^\/\?]+)(\?.|\ .) RewriteCond %{REQUEST_FILENAME} !/main\.php$ RewriteRule . /main.php?g2_view=core.DownloadItem&g2_itemId=%1&g2_serialNumber=%2&g2_fileName=%3 [QSA,L] RewriteCond %{THE_REQUEST} \ /Key-Word/([^?]+)(\?.|\ .) RewriteCond %{REQUEST_FILENAME} !/main\.php$ RewriteRule . /main.php?g2_view=core.ShowItem&g2_path=%1 [QSA,L] RewriteCond %{THE_REQUEST} \ /([^?]+)(\?.|\ .) RewriteCond %{REQUEST_FILENAME} !/main\.php$ RewriteRule . /main.php?g2_view=rewrite.FileNotFound [QSA,L] </IfModule> I have everything working, the URL is pointing without the main.php showing and the permalinks are showing properly, BUT one thing. The images are not showing and when you click on the permalink, it shows as an error page. Can anyone help? Thank you for your support, |
|
nivekiam
![]()
Joined: 2002-12-10
Posts: 16504 |
![]() |
What's the error message? Can you share a link to your page? Can you turn debug mode on and post the output? If the output it more than 30 lines or so, copy it into a text file and attach that to your post. |
|
dichev
![]()
Joined: 2007-05-25
Posts: 15 |
![]() |
Please, note, that if replacing main.php with index.php, you may lose some important functionality and I am not sure, but some plugins may stop work. For example: the webservice for Windows XP upload and Gallery remote. See my Gallery2 at: http://dichev.com/gallery/ |
|
nivekiam
![]()
Joined: 2002-12-10
Posts: 16504 |
![]() |
I have not tested this, but for the PublishXP feature, you might be able to change the registry entry to get that working. Gallery Remote might involve more work if the GR client it hard coded to look for main.php instead of just using the URL provided, whether it's index.php, main.php or a directory |
|
dichev
![]()
Joined: 2007-05-25
Posts: 15 |
![]() |
I have already migrated to gallery/ instead of gallery/main.php more than a month ago as a result of some changes in the source, which unfortunately I do not remember. I will try to activate the functionality of Publish XP by modifying the registry file before importing it. See my Gallery2 at: http://dichev.com/gallery/ |
|
smjdesign
![]()
Joined: 2007-02-26
Posts: 25 |
![]() |
As to things you can do to add SEO to your Gallery2, you can try some of the things in the message, Thirteen Ways To Add SEO To Gallery2, at http://gallery.menalto.com/node/70008 Some of them have already been mentioned above, so some of the items in this thread are repeated, but I thought it would be good to centralize them into one list. If anyone has additions to suggest, I'd love to add more. --Stephen |
|
JST
Joined: 2008-01-02
Posts: 6 |
![]() |
Try GalleryTheme.class /** if (!empty($theme['parents'][$i + 1]['id'])) { **/ Commenting this out worked for me. Found it somewhere here too! |
|
shahinfard
![]()
Joined: 2008-11-18
Posts: 8 |
![]() |
Hi, I'm trying to remove the G2_Highlight variable appearing on the end of all Breadcrumb links. I can't find an "arg3="highlightId=`$theme.item.id" Can you help? File: /gallery/modules/core/templates/blocks/local/BreadCrumbs.tpl Quote:
{* Thanks |
|
smjdesign
![]()
Joined: 2007-02-26
Posts: 25 |
![]() |
@shahinfard Read "9. Optimize permalinks" on my link two posts up: --Stephen |
|
shahinfard
![]()
Joined: 2008-11-18
Posts: 8 |
![]() |
I did read that but I didn't understand what the post meant by LINE 15 - BEFORE LINE 15 - AFTER Does it meant to copy that code before and after LINE 15 - or replace? |
|
smjdesign
![]()
Joined: 2007-02-26
Posts: 25 |
![]() |
No, it's the state of the code. Before editing and after editing. You want to replace the before code with the after code. --Stephen |
|
shahinfard
![]()
Joined: 2008-11-18
Posts: 8 |
![]() |
doh! I feel like a complete dumbo.. thank you - I'll have a go |
|
shahinfard
![]()
Joined: 2008-11-18
Posts: 8 |
![]() |
You are the Don.. it worked thank you! |
|
wideaware
![]()
Joined: 2006-06-21
Posts: 16 |
![]() |
I have links to my gallery pointing to the folder, and rather than redirects, I chose to do this in the .htaccess DirectoryIndex main.php index.php index.html Seems to be working fine. ======= |
|