Monday , 1 June 2020
Stackode

Recent Posts

Deny a user by IP Address

Deny a user by IP Address – There may come a time when you unfortunately need to ban someone from visiting your website completely. This is very easy to do using htaccess and can be useful if there is a spammer or disgruntled member attacking your site (something which unfortunately happens a lot to forum and blog owners). To ban ...

Read More »

Change the Default Directory Page

Change the Default Directory Page – When you load a directory on the web, for example www.yoursite.com or www.yoursite.com/articles/, the apache server usually looks for the index.html file. If it can’t find that it will look for index.php or index.cgi. Index.html is usually the page with the highest priority and the one which is loaded first. It is possible to ...

Read More »

How to Stop Directory Listing

How to Stop Directory Listing – If you have a lot of files in a directory but no index file, your server will list all the files in that server. This can cause a lot of problems. For example, one of the most common directories which webmasters forget to hide is the images folder. This allows everyone to view all ...

Read More »

How to edit file htaccess

How to edit file htaccess – Before you upload an .htaccess file to your server, make sure there is not already one there. Your host panel or perhaps a script you have uploaded may have already changed the htaccess for some reason so you don’t want to overwrite it as doing so could change something important on your site. Htacess ...

Read More »

Htaccess Password Protect a Directory

Htaccess Password Protect a Directory is easy to do, all you have to do is : Add some code to your .htaccess file Create a file called .htpasswd Select a username and generate an encrypted password and then add them to your .htpasswd file Code to add to your Htaccess You need to add the following code to your .htaccessfile. ...

Read More »

Htaccess Supersession

Htaccess Supersession – The most common place to upload an .htaccess file is the root ie. the home page of your website. This is because so many things can be controlled from the top level. However, there are many occasions when you will need to upload an .htaccess file to a sub directory. Htaccess Password Protect For example, if you ...

Read More »

About Htaccess

About Htaccess – The htaccess file is a powerful tool which can redirect users, ban visitors, password protect directories and much more. Htaccess Coding Yet it remains something which intimidates many webmasters because of how complicated the code is. However, just like any programming language, once you have used it a while it becomes more familiar to you. I hope ...

Read More »

How to Redirect your 404 error to a Custom Page

How to Redirect your 404 error to a Custom Page – A 404 error message is the standard HTTP standard response code which is returned when the visitor cannot communicate with the server. Visitor gets a standardized undesirable 404 Error Page This is a very common error on the web and it occurs when you are trying to visit a ...

Read More »

How to setup a 301 Redirect

How to setup a 301 Redirect A 301 HTTP response status code is a way of telling search engines that a page, pages, directory or entire website has been permanently moved to another place on the web. Htacess Redirect This is very useful if you have changed the structure of your websites url’s or if you have moved domain. You ...

Read More »

Htaccess Basics

What is htaccess? Htaccess Basics – Hypertext Access, commonly shortened to htaccess, is a powerful configuration file which controls the directory it is placed in and all the subdirectories underneath it. Htaccess is a useful feature allowing webmasters to control how many aspects of their website workings. Htacess to Redirect Pages You can use 301 redirect for pages not found; ...

Read More »

Force users to use the WWW or Non-WWW version of your domain

Force users to use the WWW or Non-WWW version of your domain. To avoid duplicate content in search engines you can force users to use either the www or the non-www version of your website domain. This avoids search engines such as Google indexing two versions of your domain, something which is quite common because people link to both www ...

Read More »

String Functions SQL

String Functions SQL are used primarily for string manipulation. The following table details the important string functions: Name Description ASCII() Returns numeric value of left-most character BIN() Returns a string representation of the argument BIT_LENGTH() Returns length of argument in bits CHAR_LENGTH() Returns number of characters in argument CHAR() Returns the character for each integer passed CHARACTER_LENGTH() A synonym for ...

Read More »

Numeric Functions SQL

Numeric Functions SQL are used primarily for numeric manipulation and/or mathematical calculations. The following table details the numeric functions: Name Description ABS() Returns the absolute value of numeric expression. ACOS() Returns the arccosine of numeric expression. Returns NULL if the value is not in the range -1 to 1. ASIN() Returns the arcsine of numeric expression. Returns NULL if value ...

Read More »

CONCAT Function SQL

CONCAT Function SQL is used to concatenate two strings to form a single string. Try out the following example: SQL> SELECT CONCAT('FIRST ', 'SECOND'); +----------------------------+ | CONCAT('FIRST ', 'SECOND') | +----------------------------+ | FIRST SECOND | +----------------------------+ 1 row in set (0.00 sec) To understand CONCAT function in more detail, consider an employee_tbl table, which is having the following records: SQL> ...

Read More »

RAND Function SQL

RAND Function SQL that can be invoked to produce random numbers between 0 and 1: SQL> SELECT RAND( ), RAND( ), RAND( ); +------------------+-----------------+------------------+ | RAND( ) | RAND( ) | RAND( ) | +------------------+-----------------+------------------+ | 0.45464584925645 | 0.1824410643265 | 0.54826780459682 | +------------------+-----------------+------------------+ 1 row in set (0.00 sec) When invoked with an integer argument, RAND( ) uses that value ...

Read More »