Redirect Link to Mobile Website using .htaccess

Just add the following code in your .htaccess file


RewriteEngine on
RewriteBase /

# prevent looping
RewriteCond %{HTTP_HOST} !^m.mysite.com$

# 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|up.link|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 .? http://m.mysite.com%{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.

Install WordPress with Multiple Domains or Subdomains

To change WordPress from the standard single site install to a WordPress Multisite which allows you to create a network of sites you need to:

  1. Update your wp-config.php file.
  2. Choose the structure of your Multisite in terms of whether you want to use sub-domains or sub-directories.
  3. Add the extra lines your WordPress installation generates into your wp-config.php.
  4. Add the generated mod_rewrite rules to your .htaccess file, replacing other WordPress rules.

You do this as follows:

Updating your wp-config.php file

  1. Locate your wp-config.php file on your hard drive.
  2. Open your wp-config.php file for editing.
  3. Add the following line to your wp-config.php file:
define('WP_ALLOW_MULTISITE', true);

above where it says /* That’s all, stop editing! Happy blogging. */: Continue reading

What is the default Maximum file upload size and how to change it?

By default Maximum file upload size is 128MB.

php_value upload_max_filesize 128M
php_value post_max_size 128M

If you want to change the default Maximum file upload size from 128MB to 1GB, then it can be done by changing in the these files..

1.) In .htaccess file (Apache + mod_php) add the following two lines to a .htaccess in the installed directory:

php_value upload_max_filesize 1G
php_value post_max_size 1G

2.) In php.ini file, which is located in the php folder (like C:/xampp/php/php.ini)

upload_max_filesize = 1G
post_max_size = 1G

After modifying the global php.ini you will need to restart the webserver to have changes take effect.