Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By snackmaster on
The most popular page on my site is the main page of the Gallery2 install.
How can I prevent this? I only want people to view my photos through the Drupal site and the /gallery/ mapping.
/gallery2/main.php
Comments
One way I could think of
One way I could think of would be to hack the main.php page to check the referrer. Something like:
Incidentally, that's one of the reasons I use acidfree for photos on my website. It's integrated with Drupal and I have the files being served by the filemanager module.
Good luck!
-- Doug
--
Douglas Muth, Philadelphia, PA
http://www.claws-and-paws.com/
Redirect
Thanks! Thats what I was looking for but my redirect skills were of the endless loop variety :)
That said, the above code generates an "unexpected T_STRING" error on the header line when placed at the very top of the main.php page. I played a bit but couldn't get rid of it. Ideas?
Yeah, there was a typo in my
Yeah, there was a typo in my code.
It should read:
header("Location: http://yourwebsite/gallery/");
That's what I get for writing code when I'm tired. :-P
--
Douglas Muth, Philadelphia, PA
http://www.claws-and-paws.com/
Redirect - still not working
Sorry to say there appears to eb another typo and once functional the behavior is quite odd (to me).
This line
if (ststr(getenv("HTTP_REFERER"), "node") )
needs to have ststr be "strstr"
Once I change that and put in my URL I'm not quite sure what to put in where you have "node" since my problem visitors aren't accessing a Node but the Gallery site directly so I put in that URL.
Once I do that the Gallery main.php page still laods but no pictures show up. Same happens on the main Drupal site.
Clueless here how to get this working.
(dmuth is mumbling, Acid Free! you moron! :)
robots.txt
I had a similiar issue. Google was mostly indexing my /gallery/ pages but it also indexed a few /gallery2/ links, which I did not want. In addition to the solution suggested earliar, I would also suggest you create a robot.txt on your main site with a similiar content:
Deepak
Robots are lawless rebels
From day 1 I've had the code to disallow, even before I launched the site. SE's apparently pay no heed :(
User-agent: *
Disallow: /gallery2/
Disallow: /includes/
Disallow: /misc/
Disallow: /modules/
Disallow: /scripts/
Disallow: /sites/
Disallow: /themes/
The robots.txt file only
The robots.txt file only contains "suggestions" for search engines to follow. Well behaved search engines like Google will listen to that. But a poorly behaved one (or a spambot) will not.
Furthermore, robots.txt is NOT an access control mechanism So you'll have to use some other method of preventing access to those files.
-- Doug
--
Douglas Muth, Philadelphia, PA
http://www.claws-and-paws.com/
Robots.txt
Yep I'm aware of the basic uselessness of Robots.txt thanks to unscrupulous SE's but use it anyhow as a few SE's appear to actually follow the convention.
I'd like to get a programatic of server based dissallow script that protects my hot folders (redirects them to he77), is there a known list of offending engines?
Gallery2 supports an
Gallery2 supports an "embedded only" mode defined in config.php. Change the line:
$gallery->setConfig('mode.embed.only', false);
to true.Maybe that will do what you need.
Gallery2 - "embedded only"
Awesome tip. I found the code at line 130 of my config.php file.
I se it to "true" as above, problem is it had zero affect. I used the admin to clear the Gallery DB cache, made sure I wasn;t a logged in users etc. Tried clearing local cache and different browser but /gallery2/main.php still loaded no problem.
Thanks to all for the help, I'll keep looking!
If embedded-only does not
If embedded-only does not work then I suggest you raise the issue in the Gallery2 support forum.
and also...
Give us a feedback when you'll have the answer :)
Alexandre Racine
www.gardienvirtuel.com Sécurité informatique, conformité, consultation, etc
www.salsamontreal.com La référence salsa à Montréal
It works!
Doing so works. Now, it would be great if I could add a redirection instead of showing a big ERROR message!
Anyone know how to do it?
Alexandre Racine
www.gardienvirtuel.com Sécurité informatique, conformité, consultation, etc
www.salsamontreal.com La référence salsa à Montréal
got it...
Just play with the error.tpl template...
There you go...
Alexandre Racine
www.gardienvirtuel.com Sécurité informatique, conformité, consultation, etc
www.salsamontreal.com La référence salsa à Montréal