Richard Castera - Explorations in Software Development
Richard Castera - Explorations in Software Development
Browsing Category
Resources
Resources Scripts Web Server

How to Create a Custom 404 Error page with .htaccess

October 20, 2009 2 Comments

Everyone’s encountered those standard 404 error pages that yield little or no information. Most new systems have this feature built in by default and often times are pretty fancy with informative to funny graphics and lots of options on what to do next but, if your working on updating an old site not using dynamically based web pages then, your going to have to add one manually. For your user’s experience, it’s better to provide a helpful error message and links to where they can continue on their quest for information. You don’t want to scare your visitors away do you? Here’s how to add your own custom 404 error page to your website:

If you don’t already have an .htaccess file in your servers root, go ahead and create one. Now you need to instruct .htaccess where your custom error page is. In this example, I have the 404 document which I created with my editor that provides lots of useful information for users to continue browsing my site. Now add this line to your .htaccess file and that’s it!

Apache
1
ErrorDocument 404 /404.html
Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources Scripts Web Server

Disallow hotlinking while allowing requests from robots.txt and favicons

October 18, 2009 No Comments

We all hate Leechers. Here’s how to stop them in their tracks from stealing your images and your bandwidth!

Apache
1
2
3
4
5
6
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_URI} !(^/robots\.txt|\.ico)$
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example.com(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp|pdf)$ [F,L]
Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources

How to create a sandbox PayPal Payflow account

October 12, 2009 12 Comments

I’ve been working with PayPal PayFlow Pro a lot lately. But before I got the hang of it, I couldn’t figure out how to create a sandbox account for Payflow.

As it goes, it’s different than setting up a standard sandbox account. To set up a Payflow account for testing, you would walk through the sign up process as if you were signing up for a live Payflow account.

Once you get to the section in the sign up process where it is asking for the billing information, just cancel out of the process. This creates a test account for you at this point, which you can access by signing into PayPal Manager with the login and password that you created. The partner will be PayPal.

Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources Web Server

Creating an .htaccess file on Windows

October 9, 2009 3 Comments

Everyone who has tried creating a .htaccess on windows knows that Windows Explorer does not accept the ‘.’ character as the first character of a file. For most of you this may be old stuff, but for the newbies, the quick way to create a file that starts with a ‘.’ is actually pretty simple.

Open notepad and save the document with file name .htaccess with the ‘save as type’ set to ‘All Files’; or save the document with file name as “.htaccess” including the quotes. Hope this helps someone!

Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources Scripts Web Server

htaccess – How to redirect all http (port 80) requests to https (port 443)

September 13, 2009 4 Comments

Sometimes you may need to redirect http requests on port 80 to (https) on port 443. This can easily be accomplished with .htaccess.

Apache
1
2
3
RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [NC,R,L]
Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources Scripts

Magento – How to run a SQL query against the database

August 23, 2009 7 Comments

In order to run a SQL query against the Magento database, you first need a resource model then a database connection.

PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php
$db = Mage::getResourceSingleton('core/resource')->getConnection('core_write');
$result = $db->query('SELECT 'entity_id' FROM 'catalog_product_entity');
if (!$result) {
    return FALSE;
}
$rows = $result->fetch(PDO::FETCH_ASSOC);
if (!$rows) {
    return FALSE;
}
print_r($rows);
?>
Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources Scripts

Magento – Database Repair Tool

August 20, 2009 No Comments

The Magento Database Repair Tool compares 2 databases (reference and target), and updates the target database so it has the same structure as the reference database by doing the following:

  • Adds missing tables, or repairs them to have the same engine type and char-set.
  • Adds missing fields or repairs them.
  • Removes inconsistent data from tables that have broken foreign key references.
  • Adds missing foreign keys and indexes.

You can download it here. For a full list of features and instructions, you can refer to this wiki post.

Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources Scripts

Magento – Add additional fields to the Contact Form

August 16, 2009 38 Comments

If you need to add additional fields to Magento’s default contact form, read on! First open the form.phtml file located in your /magento_root/app/design/frontend/YOUR_INTERFACE/YOUR_THEME/template/contacts/form.phtml. So, we are going to add a subject field to this contact form so that customers tell us the subject of their email. Open the file for editing in your favorite editor.

Find this section in the file below (this should be around line 39):

XHTML
1
2
3
4
<div class="input-box">
    <label for="name"><?php echo Mage::helper('contacts')->__('Name') ?> <span class="required">*</span></label>
    <input name="name" id="name" title="<?php echo Mage::helper('contacts')->__('Name') ?>" value="<?php echo $this->htmlEscape($this->helper('contacts')->getUserName()) ?>" class="required-entry input-text" type="text"/>
</div>
Continue reading
Reading time: 2 min
Share:
Written by: rcastera
Resources Thoughts

Magento – The best Magento Extensions

August 11, 2009 28 Comments

Here are some of the best Magento extensions that I’ve come across.

  • Magento Live Chat – This free module will provide LiveChat support in Magento.
  • Fontis WYSIWYG Editor – This extension gives you the option to enable a JavaScript WYSIWYG editor to specified admin pages. Currently available editors are: TinyMCE and FCKeditor.
  • Lazzymonks Twitter – Displays Twitter updates in the menu and allows updates from within the admin panel.
  • Events Calendar – With this extension, you can display an events calendar on your website. Events are stored in the database. You can also display the upcoming list of events quickly by calling a block in your template.
  • Blog – Full featured blog extension for Magento.
  • Raffle – This module gives you basic functionality to run your own raffles.
  • Customer Groups Configurable Catalog – This extension enables you to hide categories and products from customers depending on the customer group.
  • Exploded Menu – Replaces the standard single column drop down with a multi-column dropdown featuring 2nd and 3rd level menu items.
  • Velite Magento Superstage – Functionality, intuitive interaction and product presentation with really high detailed images are the main features.
  • Magento EasyLightbox – This small extension will help to install Lightbox widget. Installation and configuration will take approximately 5 minutes. No files are replaced and no codding experience needed to install!
  • Magento Exploded Menu – Replaces the standard Magento menu with a multi-column drop down menu system.
Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources Scripts Thoughts

Drupal – The Best and my Favorite Modules

August 9, 2009 2 Comments

I’ve worked with Drupal in the past for several projects and have come across some modules that have become my favorites. Here they are:

Continue reading
Reading time: 2 min
Share:
Written by: rcastera
Page 3 of 9« First...«2345»...Last »

About me

Hello, my name is Richard Castera. I have more than 12 years of experience architecting, implementing, leading and launching large scale, high performance software products in a fast-paced agile environment.

Popular Posts

Magento – Display new products on the home page

May 20, 2009

How to Fix “Internet Explorer Cannot Open the Internet Site- Operation Aborted” Error

May 9, 2009

PHP – Convert Array to Object with stdClass

July 5, 2009

Categories

  • Home Automation
  • Resources
  • Scripts
  • SEO
  • Thoughts
  • Web Server

Tags

Apache Apple Bash CSS Drupal Free home automation htaccess Java Javascript Magento PHP raspberry pi SEO SQL thoughts Wordpress

© 2019 copyright Richard Castera // All rights reserved