>jQuery $.ajax and $.post

>Below is an ajax jQuery code that allow uses for POST. Communication between two pages.

$.post is a simpler version with less features than $.ajax. In the code below they are both configured to do the same concept.

mouseover me Type in box to see ajax

>How to redirect

>Below are examples on how you can redirect your website. When someone visits your site and you want the traffic to go somewhere else. Choose your language, modify url and copy and paste.


location.replace("http://baligena.com") //or
location = "http://baligena.com";


header( 'Location: http://www.baligena.com' ) ;


<meta HTTP-EQUIV='REFRESH' content='0'; url='http://www.baligena.com'>

Working with .htaccess

What is .htaccess:
.htaccess (hypertext access) is the default name of a directory-level configuration file that allows for decentralized management of web server configuration. -Wikipedia

.htaccess is a way to modify the web server without editing the Master file.

In Apache the master file is called httpd.conf

How to create 404 and 403 pages:
404 pages appear when it doesn’t exist (alternative to index.html in every directory on site) and 403 is a page exist but is forbidden to access.

In order for .htaccess to work you need to configure httpd.conf
AllowOveride must be set to All. See below. Remember its case sensitive. For some reason apache ships as “all” instead of a capitalized “All”.

# AllowOverride controls what directives may be placed in .htaccess files.
# It can be “All”, “None”, or any combination of the keywords:
# Options FileInfo AuthConfig Limit
AllowOverride All

What to put in .htaccess:
ErrorDocument 404 /yourerrorpage.html
ErrorDocument 403 /yourerrorpage.html

# Options -Indexes is what allows the 403 error to work
Options -Indexes

If you don’t want to use .htaccess you can simply put
ErrorDocument 404 http:yourerrorpage.html
ErrorDocument 403 /yourerrorpage.html

Warning: Make sure you always restart Apache when changes are made to the httpd.conf because the changes won’t be taken into effect until you do

You must edit httpd.conf at the server, you can’t use ftp unless it’s not secured. It should be located at /etc/apache2/httpd.conf or separated in various files in /etc/apache2/ folder

How to rewrite URLs?
To manipulate your links like transfroming ?name=page&URL’s into /friendly/cute/links
you must activate rewrite_module in Apache.

Left click on the wamp icon then hover over “Apache” and go to “Apache Modules” and click on rewrite_module (or mod_rewrite) so it has a check. (or 500 Internal Server Error may throw)

or open httpd.conf and uncomment(remove #) the line below
LoadModule rewrite_module modules/mod_rewrite.so

Wait for Apache to restart.

In .htaccess insert this code:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) mvc/index.php/$1


RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

More information:

Good MVC clean URL video

Ubuntu server 11.10
Now the mod rewrite is a little different in the Ubuntu server. You have to create a “rewrite.load” symlink from /etc/apache2/mods-available to /etc/apache2/mods-enabled by running:
$ sudo a2enmod rewrite
then edit:
$ sudo nano /etc/apache2/sites-available/default
and make line 11 to AllowOverride None to AllowOverride All, see snippet below (if .htaccess is not working or not being read)

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all

then restart apache:
$ sudo service apache2 restart

reference: http://www.techytalk.info/enable-apache-mod_rewrite-on-ubuntu-linux/

description: mod_rewrite wamp, .htaccess issue (500 – Internal Server Error), .htaccess apache mvc configuration 500, redirecting and rewriting

Fully functional .htaccess script

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

apache config file in ubuntu location

>Debugging for Internet Explorer

>I posted earlier that I will stop going out of my way to make a site compatible with Internet Explore. However that is not a choice for everyone and if you have a client who is out of touch they might want comparability with IE so here is a link to My Debugbar IE tester. Its a free software that allow you to test your website on all IE version without having to download IE.

Seen at Slice and Dice that PSD second video towards the end.

>Reset CSS

>Reset stylesheet is to reduce browser inconsistencies in things like default line heights, margins and font sizes of headings, and so on

Paste code below in stylesheet and delete the elements you do no need

/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
body {
line-height: 1;
ol, ul {
list-style: none;
blockquote, q {
quotes: none;
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
table {
border-collapse: collapse;
border-spacing: 0;

>Creating columns in website

>This tutorial shows how to create columns in website and prevents the div from wrapping when the browser is minimized

Syntax Source:

#main {
width: 600px;

.col {
float: left;
border: 1px solid red;
padding: 10px;
margin: 0px 20px 0px 0px;

<div id="main">
<div class="col">
<div class="col">
</div> <div class="col">

>No security

>Be careful when you trust your job. I had a couple of bad experiences at a job. You never know if your boss is going to fire you, lay you off, go out of business, or disapprove you work history. I always try to improve my skill. The main reason is that if I lose my job at least I can fall back on something. Whatever skill you acquire at your job rarely will be transferred to another. Your going to have to start from the bottom again. I worked at many places where the supervisor only watches people and surf the internet for a living. It makes me sad to know that they’re screwed if they lose their job. Be like the ant the prepares for the winter, do this in all areas of life.