Redirect Using htaccess

To redirect using .htaccess file use the following code

Redirect 301 / http://example.com/

Or use this to redirect only specific page

Redirect 301 /old-url http://example.com/new-url

Change 301 (permanent) with 302 (temporary) to suit your need.

Fix ”Google Play Authentication is Required” Error

If you have this problem, you can try to clear data and cache for google play store. Follow the following steps if you don’t know how.

  1. Go to Settings -> Application or Application manager on some
  2. From there select on google play store
  3. Tap the clear cache and clear data button
  4. Close and reopen google play store

The error should be gone by now.

Exporting large database on phpMyAdmin

Exporting large database from most web hosting company can be quite problematic due to their server timeout limit setting.

To get around this problem one alternative solution is to check which table has the most size and export it individually, then you can export the rest of the table by excluding the one you already exported it before.

MySQL Basic Command Cheat Sheet

# Create user
CREATE USER 'username'@'hostname' IDENTIFIED BY 'mypassword';

# Show user
SELECT username FROM mysql.user;

# Grant privilege
GRANT ALL PRIVILEGES ON *.* TO 'username'@'hostname';
Or
GRANT SELECT, INSERT, UPDATE, DELETE ON database.table TO 'username'@'hostname'

# Revoke / remove privilege
REVOKE ALL PRIVILEGES ON object FROM username

# Dump data
mysqldump -h hostname -u root -p databasename > filename.txt

# Import data
mysql -u username -p databasename < sqlfile.sql

# Alter to fulltext
ALTER TABLE tablename ADD FULLTEXT(fieldname);

# Alter character set and collation, CONVERT change all columns
ALTER TABLE tablename CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

# Show character set of a table
SHOW FULL COLUMNS FROM tablename

# Show table option when creating that table
SHOW CREATE TABLE tablename;

# Show all table status
SHOW TABLE STATUS;

Android Phone Navigation Key Not Working

Recently my Android phone navigation key stopped working, and factory reset didn’t do any good at all.

If you have this problem, and in need of a quick fix you can try this temporary solution.

  1. Access Playstore
  2. Search for “button savior”
  3. choose one and install

After installation, a list of navigation button would be available on the side of the screen. Depending on which app you install it can be on the right / left / bottom of the screen. You can use this button as a temporary replacement for the original android navigation button (until you can fix the real problem that is).

Password Protect Directory With .htaccess

To create authentication using htaccess do the following:

  1. Open up console and type htpasswd -c .htpasswd username to create .htpasswd file.
    or alternatively you can search for .htpasswd generator online
  2. Put the newly created .htpasswd file somewhere hidden.
  3. Create .htaccess file with the following content:
    AuthType Basic
    AuthName "Any title you want"
    AuthUserFile /path/to/.htpasswd
    require valid-user
  4. Put the .htaccess file inside the directory you want to password protect