Category Archives: Hosting

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

DNS Configurations

Server A -> sub domain -> Server B

目前Domain是指到Server A, 但是想要開一個subdomain指到Server B

  1. 取得Server B的IP
  2. 在Server B中建一個sub domain
  3. 在Server A中建一個sub domain
  4. 修改#3 sub domain的A record, 指到#1的IP

GSuit -> Godaddy

  1. 如果網址是在gsuite買的,在Gsuite控制台會有地方查詢到網域相關的資料,並且有登入godaddy domain manager的帳密和網址
  2. 在Godaddy另外開一個帳號建立網站
  3. #2完成後,在網域的地方可以查到server的IP
  4. 在#1的domain manager中,把A record指到#3的IP

Reference:

.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

XAMPP Security Settings

Alias of phpmyadmin: C:\xampp\apache\conf\extra\httpd-xampp.conf

  • http://stackoverflow.com/questions/12355054/after-changing-documentroot-xampp-still-using-default-phpmyadmin
  • http://answers.yahoo.com/question/index?qid=20090114205816AA1XBPm