Wednesday, April 16, 2014
Text Size

301 Redirect using htaccess file

There are a lot of articles & posts out there that cover the same topic, but as this took me the good part of an hour just to find out, I'm posting it here so I never have to look for it again.

A client changed their website domain address and wanted any person visiting the old domain to be redirected to the new domain.

I warned that a 301 site gets removed from the Google directory and true to form Google have removed it. Not sure why nobody believed me when I raised the alarm but hey-ho.

I'm going to show you how to do this with a .htaccess file:

htaccess Rewrites SEF URL and submits to PHP

A quick note on a htaccess rewrite rule I'm liking.

What does it do?
What I type:

Sends this to server:


A picture of the Internet

Just a pretty picture on how hackers have created an infographic of the internet:

Infographic of the Internet

Source: BitBucket.Org - Internet Census 2012

Code Troubleshooting Checklist

So I've started this list to make sure I don't spend so long anymore on debugging code. The aim of this article is to quickly suggest ways of pinpointing the source of the problem:

Basic Tests for SQL-Injection Vulnerabilities

I'm putting this article here so that I can run through a checklist when I am adding an input field to an interface.

There is a strange complacency in many applications released for public use which are vulnerable to SQL Injection. According to the industry over 60% of attacks on websites is through SQL-Injection alone.

SQL-Injection is not as complicated as it is made out. An input field in a website form is where the hacker can add code that can drastically affect a database-driven website. Take a search engine for instance, this is a field which the end-user can freely enter any text they want, especially any code. But a search engine is just one example, you need to test EVERY input field the end-user can access. For more information on SQL-Injection, please read my article "Anti-SQL Injection Basics".


Latest Posts

  • 301 Redirect using htaccess file

    • Tue 15-Apr-14
      Further suggestion:
      RewriteRule ^(.*/)?assets/s 2dmain.html\?/( .*/)? $2 [R=301,L]
    • Thu 10-Apr-14
      Playing with some RegEx testers
      RewriteRule ^(.*\?/)?(?:$|( .+?)(?:(\.[^.]$ )|$)) $2 [R=301,L] ...
    • Wed 09-Apr-14
      I tried to redirect links from my old site to my new site, based on what I read in this thread. The old ...
  • JComments 2.3.0 with ReCaptcha in Joomla 2.5.x

    • Fri 28-Mar-14
      You are a rockstar mate! thanks. Followed the steps listed and it worked! If only all tutorials were ...
  • K2 Items disappear

    • Thu 03-Apr-14
      The fix works great, but the problem is occurring a couple of times a day. Any idea how to fix ...
      Larry C.