Category Archives: append

Append Query String to htaccess PDF Redirect URL

I have PDF's that are available for download ONLY if people request a download key. All of that works perfectly. The problem is, if a person knows the URL to the PDF, they can access it directly. I want to block access to all the PDF's on my site while still allowing downloads. After days upon days of research and trial-and-error, I've come to believe that a redirect might be the best solution. Unfortunately, I can't seem to make anything work.

I created a sample subdomain to demonstrate the issue.

PDF URL: http://design.productivemotherhood.com/pdf/home-sellers-secrets-ebook.pdf

REDIRECT URL: http://design.productivemotherhood.com/index.php?msg=noKey

As you can see, I'm trying to redirect to the index while attaching a 'msg' parameter containing the message 'noKey'. It is important that this parameter be passed when the page redirects so that the index will display the error message.

The following statement will redirect the PDF's, but I can't figure out how to append the parameter to it.

RedirectMatch 301 (.pdf) http://design.productivemotherhood.com/index.php

I've been looking for a solution for the past 3 days, but I just can't seem to find anything that works.

Apache Camel keeps previously processed files in memmory

I want to process the same file name multiple times and override the output file (which is set by default). I noticed that after copying the a file with the same file name the content of the resulting file has the content of the previously processed files. At first I though it was not overriding but appending, so I deleted the output file and copied the input file. The file generated contains the information from the previous processed files plus the new file.

Anyone has an idea why?

Here is the code I am executing:

from("file:C:\\Camel\\in?fileExist=Override&delete=true")
        .unmarshal()
        .csv()
        .marshal()
        .json(JsonLibrary.Jackson, true)
        .to("file:C:\\Camel\\out?fileExist=Override&fileName=generatedFile.json");

accessing DOM structure between prepend and append (.htaccess) in php

Is it possible to get DOM structure between prepend file and append file?

in .htaccess:

php_value auto_prepend_file "sys/sys.php" php_value auto_append_file "sys/sys_run.php"

Regular index.php is wrapped between sys.php and sys_run.php with

<div id='contents'>

in sys.php and

</div>

in sys_run.php

So I want the sys_run.php to be able to get index.php dom element contents automatically, without hardcoding, mb using __FILE__ constant?

Update .htaccess with current IP address

Excuse my ignorance, just getting to grips with CentOS bash properly.

What I'd like to do is have a .sh script that I can enter my current home IP address into, and run manually so it will update 3 or 4 .htaccess files on the web server.

How can I do this by updating just the IP in the .htaccess files?
deny from all
allow from my.current.home.IP

This way, when my Dynamic IP changes, I can quickly restore access to my private areas without going around to each file and manually editing them.

I'd rather not just pipe/append a new allow entry to the bottom of the file as I have no idea where the IP goes after me.

Can't see me being the first to want this so please feel free to post, thanks in advance.