I have a csv file export using ECSVExport class.
I have it working on my local computer running WAMP. The url would be http://localhost/example.
But it does not work on a remote server, where the url would be http://www.example.com. I get a "file not found" error (not Yii generated and does not show 404 either).
Both have mod_rewrite enabled, so I think it has something to do with that.
But just incase below is my export script
$where = "";
for($i = 0; $i < $_GET['count']; $i++){
$where .= 't.id='.$_GET[$i].' OR ';
}
$where = substr($where, 0, strlen($where)-4);
$data = Yii::app()->db->createCommand("SELECT category.name AS Category, subCategory.name AS Subcategory, t.Name, company.name AS Supplier, brand.name AS 'Sub-brand', t.percentRecycledContent, CONCAT('".Yii::app()->createAbsoluteUrl('product/view')."/', t.id) AS Link FROM Product `t` LEFT OUTER JOIN `company` `company` ON (`t`.`companyId`=`company`.`id`) LEFT OUTER JOIN `productcategory` `category` ON (`category`.`id`=`t`.`categoryId`) LEFT OUTER JOIN `productcategory` `subCategory` ON (`subCategory`.`id`=`t`.`productSubCategoryId`) LEFT OUTER JOIN companyBrand brand ON (brand.id = t.companyBrandId) LEFT OUTER JOIN `wishlistproduct` `wishlist` ON (`wishlist`.`ProductId`=`t`.`id`) WHERE ".$where);
$filename = 'wishlist-export-'.date('d-m-Y').'.csv';
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=".$filename);
header("Content-Type: application/csv");
header("Content-Transfer-Encoding: binary");
$csv = new ECSVExport($data);
echo $csv->toCSV();
My local .htacces file is:
RewriteEngine On
RewriteBase /example
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ index.php/$1 [L,QSA]
And the remote .htaccess file is:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ index.php/$1 [L,QSA]
What I am doing wrong to on the server to cause this?
Thank you in advance.