How to Create a Database and MySQL Users ?

Programming, Website Design and Management, WordPress
When you install your WordPress website manually, move your WordPress website manually, or develop a php code to run your programming. You need a database and MYSQL User. One database can have unlimited MYSQL Users. One MYSQL User can manage Unlimited Database. What I am showing you is to create one database and one MYSQL user to manage the database. The example control panel is Cpanel. All other control panel may have the same steps. You can go to your cpanel, and click MYSQL Database Wizard. Step 1: Create a Database In New Database line, you can type the name you want. I type the database as yourdatabase and then click "Next Step". It will be shown:   You have created your databasename "yourdatabase". Step 2: Create MYSQL User. Then you can…
Read More

Redirect by Php

Programming
Under PHP you need to use header() to send a raw HTTP header. Using headers()method, you can easily transferred to the new page without having to click a link to continue. This is also useful for search engines. Change the code on the redirect page to be: <?php header( 'Location: http://www.powerhoster.com' ) ; ?> You need to replace the URL above with the URL you wish to direct to. Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when…
Read More

How to Change Your Website Root Directory with .htaccess file

htaccess file, Programming
IF your website is using cpanel system, your website root directory should be /home/yourusername/public-html directory. When anyone want to visit your website, the apache server will direct it to the index file in your /home/yourusername/public_html folder. But you can change it to  different directory by .htaccess file. Just place following codes into your .htaccess file: RewriteEngine on RewriteCond %{HTTP_HOST} ^domain-name.com$ [NC,OR] RewriteCond %{HTTP_HOST} ^www.domain-name.com$ RewriteCond %{REQUEST_URI} !folder/ RewriteRule (.*) /folder/$1 [L] In the above lines you should replace the following 2 strings: domain-name.com – Type your own domain name folder – custome the folder which hold your website
Read More

How to Prevent PHP, Perl Executable scripts Run in your Image Folder with .htaccess file

htaccess file, Programming
Sometimes  you donot need to run php code in all your folder such as your image folder. In your Image folder, add following codes: order allow,deny deny from all # secure directory by disabling script execution AddHandler cgi-script .php .pl .py .jsp .asp .htm .shtml .sh .cgi Options -ExecCGI Above codes will deny all .php, .pl, .py, .jsp, .asp, .htm, .shtml, .sh,.cgi to run in your image folder.
Read More

How to redirect Http to Https Using .htaccess file

htaccess file, Programming
we can redirect the non SSL query to your website to SSL port by using .htaccess file.This will help you to access the websites from a secured port(443 of apache) of we server. in your .htaccess file, you can add following code: RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] It will direct the Normal website URL to its SSL website URL. How to redirect Http to Https in cpanel In your Cpanel, go to domain and then redirect link: Click Redirects link, and then you will go to following page:  
Read More

How to Run Your CGI Scripts outside CGI-BIN folder by .htaccess file

htaccess file, Programming
Common Gateway Interface is abbreviated to CGI. This is a standard way for web servers to interface executable scripts with end users. Those executable scripts or programs execute by this way and generate web pages dynamically. CGI scripts are usually written in scripting language, but can be written in any programming language. Most of the hosts does not allow to execute those scripts outside the CGI-BIN folder on the public folder. In order to run your cgi or perl scripts outside of cgi-bin folder. You need create a .htaccess file in the folder you want to run cgi or perl scripts. The following line should be in your .htaccess file: AddHandler cgi-script .cgi Options +ExecCGI The first line tells the apache server to run cgi script in the folder, the…
Read More

How to enable Server Side Include (SSI) with .htaccess file

htaccess file, Programming
Server Side Includes (SSI) is a simple interpreted server-side scripting language used almost exclusively for the Web.The most frequent use of SSI is to include the contents of one or more files into a web page on a web server. Server Side Includes are useful for including a common piece of code throughout a site, such as a page header, a page footer and a navigation menu. Conditional navigation menus can be conditionally included using control directives. In order for a web server to recognize an SSI-enabled HTML file and therefore carry out these instructions, either the filename should end with a special extension, by default .shtml, .stm, .shtm, or, if the server is configured to allow this, set the execution bit of the file. This is particularly useful, for…
Read More

Adding MIME Types by .htaccess file

htaccess file, Programming
In case your web hosting account is not configured to server certain mime types with the proper content type. You can change this using .htaccess file.A common occurrence with MP3 or even SWF files. Simple enough to fix: AddType application/x-shockwave-flash swf; AddType is specifying that you are adding a MIME type. The second part is the MIME type, The application string is the actual parameter of the MIME you are adding, and the final little bit is the default extension for the MIME type you just added, in our example this is swf for ShockWave File. AddType text/html htm0 the final part is the file extension, in this example 'htm0'.
Read More

How to Change the default Directory Index in Apache Server by .htaccess file ?

htaccess file, Programming
The index of a directory can come from one of two sources: A file written by the user, typically called index.html. The DirectoryIndex directive sets the name of this file. This is controlled by mod_dir. Otherwise, a listing generated by the server. This is provided by mod_autoindex. Method 1:- Edit the httpd.conf file This method can only be done by Server administrator. This method is suited for someone who uses a dedicated server/VPS. Open the httpd.conf file using a text editor and search for the following line. DirectoryIndex index.html index.htm index.php Add the file names at the end of the second line with a space. Take a look at the following example DirectoryIndex index.html index.htm index.php home.html myname.php jesin.htm In this way you add all the desired file names. Finally…
Read More

How to Block Bad Bots, Site Rippers, Crawlers, Scrapers and Malwares by .htaccess file

htaccess file, Programming
We often seen that some unidentified bots relentlessly use bandwidth of website that cause the loading speed of website become slow and affects the ranking position on search engines like Google, Yahoo, and Bing etc. Bad bots, scrapers and malwares are unwanted visitors to site and harmful to server bandwidth.  Bad bots as they are often called refers to programs which visit your web site, either to source content, look for security holes or to scan for email addresses. This is often how your email address ends up on 'Spam' databases, because they have set a 'bot' to scan the Internet and collect email addresses. These programs and 'bots' often ignore the rules set out in 'robot.txt' files. RewriteEngine On RewriteCond %{HTTP_USER_AGENT} ^AbachoBOT [OR] RewriteCond %{HTTP_USER_AGENT} ^anarchie [OR] RewriteCond %{HTTP_USER_AGENT}…
Read More