cPanel Redirect and Word Press Mod Rewrite Problem

Recently I decided to change one of my permalinks on my site from /tests to /reviews. I also set up a redirect on cPanel to redirect any traffic from /tests to /reviews this is essential as Google has already indexed /tests so setting up a 301 redirect will tell Google the page has moved and avoid a nasty 404 page not found error.

However this didn’t work once I made the redirect in cPanel I got a Word Press 404 error for both /tests and /reviews! This is because the redirect rule in your .htaccess file is added at the bottom of the file after Word Press’s mod rewrite rules. Simply add the cPanel redirect rule above the Word Press mod rewrite rule and all shall be fixed again.

Yay!

Apache Mod Security SQL Injections and Variable Names

We recently upgraded our server which was running a higher version of apache Mod Security. One of my jQuery edit in line HTTP POST requests was suddenly returning a 406 Not Acceptable error which was pretty annoying.

It was because I was using a variable called type=varChar which was used to define what sort of data was being sent. Apache Mod Security was flagging this as:

[vb]
[msg "SQL Injection Attack"] [data "varchar"]
[/vb]

So I changed all occurences of varChar to vc which has now fixed the issue.

Will remember in future to never use variable names like that again.