Redirecting client to single domain name.

Here is a problem where a site is hosted under different virtual hosts with different domain names.

VirtualHost1 is setup for
VirtualHost2 is setup for

And, we want to redirect to or show only domain to our clients.

Then, make some changes as below in main apache config file that is httpd.conf:

 <VirtualHost *:80>
  Redirect permanent /
<VirtualHost *:80>
 DocumentRoot /usr/local/apache/htdocs

Dompdf Problem in CentOS

dompdf is an useful plugin to create html to pdf file. It works fine in windows environment but it creates some problem for some version of CentOS operating system. For example, it doesn’t show any error in the browser. To fix this problem, try the following:

  1. open terminal window/shell command window.
  2. run the command:- yum install php-xml
  3. run another command:- yum install php-mbstring

The above two commands setup two important packages which is mandatory for using dompdf plugins. There is a possibility that these two packages were already installed in your OS. No matter than. If everything goes okay, then I think your dompdf plugin will now work fine.

Redirect Link to Mobile Website using .htaccess

Just add the following code in your .htaccess file

RewriteEngine on
RewriteBase /

# prevent looping
RewriteCond %{HTTP_HOST} !^$

# if the browser accepts these mime-types, it's definitely mobile, or pretending to be
RewriteCond %{HTTP_ACCEPT} "text/vnd.wap.wml|application/vnd.wap.xhtml+xml" [NC,OR]

# a bunch of user agent tests
RewriteCond %{HTTP_USER_AGENT} "sony|symbian|nokia|samsung|mobile|windows ce|epoc|opera" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "mini|nitro|j2me|midp-|cldc-|netfront|mot|up.browser||audiovox"[NC,OR]
RewriteCond %{HTTP_USER_AGENT} "blackberry|ericsson,|panasonic|philips|sanyo|sharp|sie-"[NC,OR]
RewriteCond %{HTTP_USER_AGENT} "portalmmm|blazer|avantgo|danger|palm|series60|palmsource|pocketpc"[NC,OR]
RewriteCond %{HTTP_USER_AGENT} "smartphone|rover|ipaq|au-mic,|alcatel|ericy|vodafone/|wap1.|wap2.|iPhone|android"[NC]

# rewrite rules here
RewriteRule .?{REQUEST_URI}  [L,R=302]

.htaccess and its features

HTACCESS means HyperText Access.

.htaccess files should be used in a case where the content providers need to make configuration changes to the server on a per-directory basis, but do not have root access on the server system.

Some main features of .htaccess file are:

  • ability to password protect folders
  • ban / allow users using IP addresses
  • stop directory listings
  • enable complete error reporting
  • redirect users to another page or directory automatically
  • create and use custom error pages
  • Adding MIME types
  • Setting server timezone
  • Enable SSI (Server Side Includes) with .htaccess
  • Ensuring media files are downloaded instead of played
  • Preventing requests with invalid characters
  • change the way files with certain extensions are utilized
  • use a different file as the index file by specifying the file extension or specific file.

Import Huge Database file in phpMyAdmin

Make sure you change both *”post_max_size”* and *”upload_max_filesize”* in your “php.ini” (which is located where your “php.exe” is or C:xamppphp).

The following example allows you to upload and import 128MB sql files:


Restart Apache and you’re all done !!