Tag Archives: Apache

PHP: How to enable rewrite_mod in WAMP

Have a look on below Image and follow the steps to make “rewrite_mod” on WAMP server.




You all know WAMP stands for (Windows, Apache, MySQL, PHP), It is package provide you an environment to execute your PHP application.


But the general issue you have faced with WAMP is, your rewrite rules usually not work i.e. .htaccess file is not read by Apache server (in WAMP) or give you error “Internal Server Error”.


You have to follow 2 simple steps to troubleshoot and fix the issue.


1) If you have installed WAMP on your system, then you can find a small icon in your task bar bottom right corner.


2) Click on that, you will see a menu as above

Go to
=>Apache Modules
=>click on rewrite_module
Check/tick marks that option, if you find it checked already that means it’s already enabled.


Setup Cron Job In Windows Using Wamp/Xampp Server?

You have to follow below some very simple steps to run cron file in windows system.


1. Create a cron.php file (the code you want to execute at a regular interval)


2. Create a CRON.BAT file, copy and past the below code in the file
D:\xampp\php\php.exe  D:\xampp\htdocs\Application\cron.php


The path I have written is according to my xampp and cron.php file, update the path of files according to your system directory


3. To schedule a task

Click on start > All Programs > Accessories > System Tools > Scheduled Tasks

Or you can go directly
Control Panel > Scheduled Tasks

Right click in the folder
New > Schedule Task

Give appropriate name to the Task.
In the RUN text field… Type the complete path of the CRON.BAT file

in my case it is

Set the schedule of the job, you can use advanced button if required.

I hope this all will help you. Please leave your comment if you face any issue in setup cron job in windows 🙂

Most useful 5 htaccess tricks every webmaster should know

Most useful 5 htaccess tricks every webmaster should know

1) Redirect your website visitors while you update or test your website

order deny,allow
deny from all
allow from

ErrorDocument 403 /showpage.html

<Files showpage.html>
allow from all

Replace with your IP address. Also replace showpage.html with the name of the page you want visitors to see.

2) Display a custom 404 error page

Your server displays a “404 File Not Found” error page whenever a visitor tries to access a page on your site that doesn’t exist.
You can replace the server’s default error page with one of your own that explains the error and links visitors to your home page.

ErrorDocument 404 /404.html

Replace 404.html with the name of the page you want visitors to see.

3) Handle moved or renamed pages

You’ve moved or renamed a page on your site and you want visitors automatically sent to the new page when they try to access the old one.

Use a 301 redirect

Redirect 301 /oldpage.html http://yourwebsite.com/newpage.html

Using a 301 redirect also ensures the page doesn’t lose its search engine ranking, as you know how important it is.

4) Prevent directory browsing

When there’s no index page in a directory, visitors can look and see what’s inside (directory structure and page listing).
Some servers are configured to prevent directory browsing like this. If yours isn’t, here’s how to set it up:

Options All -Indexes

5) Create user friendly URLs

Which of the two URLs below looks good?


Shorter URL is always better.

With htaccess and an Apache module called mod_rewrite, you can set up URLs however you want. Your server can show the contents of “/pages/aboutus.html” whenever anyone visits “http://yourwebsite.com/about”. Below are few examples

RewriteEngine on
RewriteRule ^aboutus/$ /pages/aboutus.html [L]
RewriteRule ^features/$ /features.php [L]
RewriteRule ^buy/$ /buy.html [L]
RewriteRule ^contactus/$ /pages/contactus.htm [L]

How to install ioncube loader in xampp

1. Find your PHP version using phpinfo() function. You should need to know the version when you download the ionCube loaders.


x86/ppc/sparc packages are for 32 bit systems;
x86-64/ppc64 packages are for 64 bit systems.


The Windows non-TS Loaders are for use on a Windows system where a phpinfo() page shows that PHP is built with thread safety disabled.


2. Download ionCube loader from: http://www.ionCube.com/loaders.php

Download this version: Windows VC9 (x86) – Windows Installer


3. Install ionCube loader to XAMPP at: D:\xampp\htdocs\ioncube


4. Open php.ini with in text editor.

The file is located at D:\xampp\apache\bin\ or D:\xampp\php\.
Add the following line before any other zend_extension statement.

zend_extension = “D:\xampp\htdocs\ioncube\ioncube_loader_win_5.3.dll”

And Save this file.


5. Run (or restart) XAMPP, and open the following link http://localhost/ioncube/loader-wizard.php


6. For security reasons we advise that you remove this Wizard script (loader-wizard.php) from your server now that the ionCube Loader is installed.
Remove this! http://localhost/ioncube/loader-wizard.php

Just done!


Note: I prefer to put the “ioncube” folder in “D:\xampp\php” instead of htdocs, if you do so, you should also update the path in php.ini file.

Set up multiple virtual hosts on XAMPP for windows

You just have to update the following files:



First of all,  uncomment the following line to enable name based virtual host on your server’s port 80:

NameVirtualHost *:80


Then you can start adding your virtual hosts. The following listing is just a sample, I usually do.I am assuming ,we create a project which should be accessible by entering http://demo-project in your browser’s address bar.

<VirtualHost *>
DocumentRoot “X:/xampp/htdocs”
ServerName localhost

<VirtualHost *>
DocumentRoot “X:/xampp/htdocs/mywebsite/webroot”
ServerName test-project

<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot X:/xampp/htdocs/demo-project/public
ServerName demo-project

<Directory “X:/xampp/htdocs/demo-project/public”>
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all


Make sure the DocumentRoot exists and matches the Directory and remember the value you set for ServerName.


2. Edit your windows hosts file

Now your apache is ready,but you have to tell your system what to do if you enter http://demo-project in your browser.The most simple way to deal this is to update your hosts file you can find it from here.


(Path wil be different if windows installed else where)


The file is just a simple text file which contains IP-to-hostname mappings. Edit the file with a text editor and append a new line which maps the hostname you specified in apache’s ServerName-directive to You can place it just under the existing one which defines localhost. In the end, your file could look like this:

# some comments        localhost        test-project        demo-project


Restart your Apache Server in order to load the new configuration and enjoy 🙂


Automatically set permission to various file types using .htaccess

Set file permissions with .htaccess, this is a great method for ensuring the CHMOD settings for various file types.


Apply the following rules in the root .htaccess file to affect all specified file types, or place in a specific directory to affect only those files (add/update file types according to your needs)

[sourcecode language=”plain”]
# ensure CHMOD settings for specified file types
# never set CHMOD 777 unless you know what you are doing?
# files requiring write access should use CHMOD 766 rather than 777
# keep specific file types private by setting their CHMOD to 400

chmod .htpasswd files 640
chmod .htaccess files 644
chmod php files 600


Require SSL (Secure Sockets Layer)

Here is an easy way you can go using .htaccess file

[sourcecode language=”plain”]
# require SSL without mod_ssl
RewriteCond %{HTTPS} !=on [NC]
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]


Guys, If you still face any issue regarding this, leave a comment in the comment box.