How to import a compressed mysql file .sql.gz using linux shell?

Login into your server using a shell program like putty.

Type in the following command on the command line

zcat DB_File_Name.sql.gz | mysql -u username -p Target_DB_Name

where

DB_File_Name.sql.gz = full path of the sql.gz file to be imported

username = your mysql username

Target_DB_Name = database name where you want to import the database

When you hit enter in the command line, it will prompt for password. Enter your MySQL password.

You are done!

Posted in MySQL | Leave a comment

Running WordPress Queries in Non-WordPress Pages

At times you might want to run the WordPress queries or wordpress functions in the page located outside the wordpress templates.

Thanks to wordpress for providing a very simple solution to this.

You just need to include the file called “wp-load.php” in the non-wordpress file before calling any WP functions and then you can run wordpress queries or call any wordpress function in that page.

wp-load.php is located in the root folder of your wordpress installation.

eg. if you have installed wordpress in your domains root folder, wp-load.php will be there in your public_html or httpdocs folder as applicable.
if you have installed wordpress in a folder say wp in your domain root, the wp-load.php shall be located in public_html/wp/ folder.

Include this file in your non-wordpress file using a require statement at the very beginning of the file.

require('../wp-load.php');
Posted in Wordpress, Wordpress Hacks | Leave a comment

Canonical URL solution – redirect non-www to www and index.php to your homepage

Canonical URL issue has always been a headache to the Webmasters and SEOs. But thanks to apache’s mod_rewrite which provide nice escapes for this problem

1. Rewrite all your urls WITHOUT www to WITH www

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^euttaranchal.com
RewriteRule (.*) http://www.yourdomain.com/$1 [R=301,L]

2. Redirect all your index.php and index.html files to homepage or directory root

Options +FollowSymLinks
RewriteEngine on

#rewrite your index.html to homepage 
#eg:  http://www.yourdomain.com/index.html to http://www.yourdomain.com/

RewriteCond %{THE_REQUEST} ^.*/index.html
RewriteRule ^(.*)index.html$ http://www.yourdomain.com/$1 [R=301,L]

#rewrite your index.php to homepage 
#eg: http://www.yourdomain.com/index.php to http://www.yourdomain.com/
RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ http://www.yourdomain.com/$1 [R=301,L]

** you can do this for default.html or other pages too depending on your default page name.

Posted in SEO, URL Rewriting, Webmaster Issues | Leave a comment

WordPress asking for FTP username/password while trying to install plugin from admin panel

This is annoying if WordPress asks for FTP username/password everytime you try to install or update plugin from admin panel.

Here is the quick hack to this.

1. Open the wp-config.php file (this will be located in the root of your wordpress installation)

2. Add the following line of code just after define(‘NONCE_KEY’, ‘put your unique phrase here’);

/* FTP login settings */
define('FTP_HOST', 'localhost');
define('FTP_USER', 'yourftpusername');
define('FTP_PASS', 'yourftppassword');

Note: Be sure to replace yourftpusername to your website’s FTP user name and yourftppassword to your website’s FTP password.

3. Upload the updated file. It works!

Posted in Wordpress, Wordpress Hacks | 1 Comment

Custom User Registration Plugins for WordPress

I have been trying hard to find an easy way out to add custom registration field to the WordPress default registration form.

I recommend the following wordpress plugin to customize, add custom fields, manage user registration, moderate user registration and edit the default email sent to the new registered users.

1. Cimy User Extra Fields
This plugin gives you the power to add custom fields to your wordpress registration form. You also get the choice to add different data types like text box, select box, radio button, text area etc with quite a few validation options.

Cimy User Extra Fields also unleashes the hidden registration fields that come with wordpress default registration form.

Download

2. Approve New Users

You can moderate New User Registration with this plugin. It adds another option “Approve New Users” under “Users” settings menu.

Download

3. New User Email Setup

New User Email Setup plugin lets you customize the default email sent to the new users upon registration. You can customize the email text, sender name, sender email and subject too. What’s more, you can even send HTML email!

Download

Posted in Wordpress | Tagged | 1 Comment