Re: [users@httpd] Force/add/append/inject HTML to documents (similar to 'Header append') for no archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Feb 19, Nick Kew (nospam-nick@xxxxxxxxxxxxxxx) typed:

Nick:  On Sunday 19 February 2006 01:50, Eugene wrote:
Nick:
Nick:  But not relevant to the question, unless you have hooks in place
Nick:  (as in SSI).
Nick:
Nick:  > There's also a 3rd-party module
Nick:  > called mod_layout that does the trick too.
Nick:
Nick:  I'd point the OP at mod_publisher which, unlike mod_layout,
Nick:  is markup-aware and won't risk breaking a page (and I'm not
Nick:  sure how reliably mod_layout can find the right place to insert
Nick:  contents).
Nick:
Nick:  On the other hand, preprocessing is probably better than any
Nick:  solution using apache.
Nick:
Nick:  > : Or does someone know of an easy way to append
Nick:  > : 	<META NAME="robots" CONTENT="noarchive">
Nick:  > : to 100+ files?
Nick:
Nick:  If you have an easy-to-find hook (like the byte sequence "</head>")
Nick:  just run a global edit, e.g. with perl.  I think it's safe to say that if
Nick:  you can fix it with mod_layout, you can fix it more easily with a
Nick:  simple perl one-liner.  But I'm willing to be proved wrong:-)


On Feb 19, Nick Kew (nospam-nick@xxxxxxxxxxxxxxx) typed:

Nick:  On Sunday 19 February 2006 08:40, httpd2@xxxxxxxxxxxx wrote:
Nick:  > If you use only one page header for all your html files, you
Nick:  > can then use that one instance for all of the pages on your
Nick:  > site by including it with something like
Nick:  >
Nick:  > <?php require "../incs/page-head.php"; ?>
Nick:
Nick:  That would be a very bad solution, several times over.
Nick:
Nick:  Firstly, it means preprocessing.  And why would one preprocess
Nick:  to that rather than to add in the required line directly?  Or if
Nick:  future flexibility is an issue, to add it as SSI which can be enabled/
Nick:  disabled at will without breaking the pages?
Nick:
Nick:  Secondly, it loses flexibility.  Not just a little, but hugely, because
Nick:  PHP - unlike SSI or any of the other apache-based solutions -
Nick:  doesn't run as a filter.
Nick:
Nick:  Thirdly it imposes an extra load on the server.  That could be
Nick:  quite modest, but for any user who has to ask the question
Nick:  in the first place, it's likely to be very substantial, because he's
Nick:  unlikely to have the expertise to use PHP without destroying
Nick:  cacheability.
Nick:
Nick:  > at the top of each html page, where the <head>...</head>
Nick:  > section would normally reside.
Nick:
Nick:  How many sites have identical <title>s on all pages?
Nick:
Nick:  > Then, you only need to make one change to the included
Nick:  > page-head.php file, to affect all the pages on your site.
Nick:
Nick:  SSI would do that more flexibly.  As would mod_publisher or
Nick:  mod_layout, without requiring the pages to be edited in the
Nick:  first place.
Nick:
Nick:  But as I already said, the best solution is almost certainly
Nick:  none of the above.




Interesting suggestions Nick.  I do have mod_include compiled in.


Im wonder though if using:
<Directory blah>
	DirectoryIndex /cgi-bin/norobots.pl
</Directory>

would be easier than a 3rd party module?



Have the PERL script do something roughly like:
	print "Content-type: text/html\n\n";
	my $FILE = $ENV{"REQUEST_URI"};
	open $FILE or die;
	while (<INPUT>)
	{
		if ($_ =~ /<\/head>/)
		{
			print "<META NAME="robots" CONTENT="noarchive">\n";
		}
		print $_;
	}


(of course this is just psudo-code off the top of my head)

Not sure what that would do to the server load.




Hmmm ... maybe I'll just use PERL to modify to the files like you
said above.




Thanks
 Birl

Please do not CC me responses to my own posts.
I'll read the responses on the list.

Archives   http://mail-archives.apache.org/mod_mbox/httpd-users/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux