Category Archives: Apache

Change upload size limit by htaccess

This solution works even in  shared server.

Cross-Origin Resource Sharing (CORS) (Ajax Cross Domain issue)

PHP:

.htaccess

Enable header module on Apache:

IIS:

Image 4

Reference:

  1. http://blog.toright.com/posts/3205/%E5%AF%A6%E4%BD%9C-cross-origin-resource-sharing-cros-%E8%A7%A3%E6%B1%BA-ajax-%E7%99%BC%E9%80%81%E8%B7%A8%E7%B6%B2%E5%9F%9F%E5%AD%98%E5%8F%96-request.html
  2. http://stackoverflow.com/questions/10640596/header-set-access-control-allow-origin-in-htaccess-doesnt-work
  3. http://stackoverflow.com/questions/869092/how-to-enable-mod-rewrite-for-apache-2-2

.htaccess

For CodeIgniter:

Note! “?” after “index.php” is must!!

https://ellislab.com/forums/viewthread/234634/

Rewrite rule for subfolders:

http://case.wikirex.com/vic/luna

Reference:

Multiple Conditions:

Reference:

  1. https://www.stormconsultancy.co.uk/blog/development/code-snippets/redirect-entire-site-with-htaccess-but-exclude-one-or-more-directories/
  2. https://mediatemple.net/community/products/dv/204643270/using-htaccess-rewrite-rules
  3. http://stackoverflow.com/questions/18964045/htaccess-redirect-all-domain-except-two-files

Redirect entire domain to another URL:

Rotate (Backup) Logs

CustomLog "|C:/xampp/apache/bin/rotatelogs.exe D:/logs/access/access_log.%Y-%m-%d 86400" combined
    
ErrorLog "|C:/xampp/apache/bin/rotatelogs.exe D:/logs/error/error_log.%Y-%m-%d 86400"

Note:

  • "|" in the beginning is required
  • Must rmeove "combined" and "common" at the end of ErrorLog or apache won't be started.

 

Reference:

  • http://httpd.apache.org/docs/2.2/programs/rotatelogs.html
  • http://www.kikinote.com/article/3780.html