Fail downloading file on Android

How hard is it, to write a PHP script to allow user to download a file? really easy, one would say. Just send the appropriate HTTP header and echo the file content.

1
2
3
4
5
< ?php
  header('Content-type: application/force-download');
  header('Content-Disposition: attachment; filename="test.txt"');
  echo(file_get_content('/path/to/file'));
?>

Basically that’s all I need to force download per PHP. But somehow Android stock browser (Chrome) only downloads and creates a 0 kB file. Other browser (tested with Firefox on Android) saves the file correctly.

What does happen here?

Continue reading Fail downloading file on Android

SEO – add trailing slash to URL

The problem

For those who use Google Webmaster Tool, they might find Google “duplicated content” warning. This is caused by slightly different URL, which is found by search engine.
Like:

http://domain.tld/google

and

http://domain.tld/google/

are interpreted as 2 different pages by search engine. So how do we resolve this?

Continue reading SEO – add trailing slash to URL

redirect URL to lowercase

Using the realurl extension TYPO3 generate human-readable URL. If the visitor visits the page using uppercase of the URL, TYPO3 can generate the page (HTTP 200). if a search bot (Google) found this URL and indexed it, Google will declare the page as “double content” and punishes your page rank. How do we deal with this? Continue reading redirect URL to lowercase