![]() |
Missing .htaccess in zip file - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Missing .htaccess in zip file (/showthread.php?tid=39349) Pages:
1
2
|
Missing .htaccess in zip file - El Forum - 03-08-2011 [eluser]spec[/eluser] I use zip functionality in CI for making quick backups during my proj. dev., but .htacess files are not included in the resulting zip file. ?? Missing .htaccess in zip file - El Forum - 03-08-2011 [eluser]InsiteFX[/eluser] Thats because they are hidden files and protected by the server. InsiteFX Missing .htaccess in zip file - El Forum - 03-08-2011 [eluser]spec[/eluser] May I archive them somehow? Missing .htaccess in zip file - El Forum - 03-08-2011 [eluser]bubbafoley[/eluser] What does your code look like? this should work: Code: $this->zip->read_file('/path/to/.htaccess'); Missing .htaccess in zip file - El Forum - 03-08-2011 [eluser]spec[/eluser] Here's the code: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> Missing .htaccess in zip file - El Forum - 03-08-2011 [eluser]bubbafoley[/eluser] read_dir() ignores hidden files. You'll need to use read_file() to add the .htaccess file system/libraries/Zip.php Code: function read_dir($path, $preserve_filepath = TRUE, $root_path = NULL) Missing .htaccess in zip file - El Forum - 03-08-2011 [eluser]InsiteFX[/eluser] You might be able to chmod them zip them and then chmod them back. The problem is that web servers hide them because of the . Mine are set at 644 which will only allow the owner to read/write anyone else only has read access. It may also be that the zip library is flagging the . InsiteFX Missing .htaccess in zip file - El Forum - 03-08-2011 [eluser]spec[/eluser] I'm using XAMPP on WinXP; how can I chmod them? In their properties, Hidden checkbox isn't checked Missing .htaccess in zip file - El Forum - 03-08-2011 [eluser]InsiteFX[/eluser] You can not chmod the files on Windows, If you want to see them then your need to change you folder/view settings to allow hidden files. InsiteFX Missing .htaccess in zip file - El Forum - 03-09-2011 [eluser]bubbafoley[/eluser] [quote author="InsiteFX" date="1299670535"]You might be able to chmod them zip them and then chmod them back. The problem is that web servers hide them because of the . Mine are set at 644 which will only allow the owner to read/write anyone else only has read access. It may also be that the zip library is flagging the . InsiteFX[/quote] The zip library only needs read access. It makes a copy of the files and then archives them. The htaccess file isn't being archived because the function read_dir() ignore files starting with a '.'. spec, here's what you can do to make read_dir() work the way you want. - Create a file in application/libraries/ called MY_Zip.php - Override read_dir() to include files starting with a '.' Ex: Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |