htaccess/web.config url rewrite from asp to php


<IfModule mod_rewrite.c>
RewriteEngine On


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond {REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [L]

RewriteCond %{QUERY_STRING} id=([_0-9a-z-]+)
RewriteRule Content\.asp$ %1 [r=301,L]




<?xml version=”1.0″ encoding=”UTF-8″?>
<rule name=”removing .php” stopProcessing=”true”>
<match url=”^(.*)$” />
<conditions logicalGrouping=”MatchAll”>
<add input=”{REQUEST_FILENAME}” matchType=”IsFile” ignoreCase=”false” negate=”true” />
<add input=”{REQUEST_FILENAME}.php” matchType=”IsFile” ignoreCase=”false” />
<action type=”Rewrite” url=”{R:1}.php” />
<rule name=”Asp classic legacy 301 redirect to php” stopProcessing=”true”>
<match url=”Content\.asp$” />
<add input=”{QUERY_STRING}” pattern=”id=([_0-9a-z-]+)” />
<action type=”Redirect” url=”{C:1}” redirectType=”Permanent” appendQueryString=”false”/>

Uploadify Uploadifive support check

Check if the browser supports “multiple” attribute for input file element, this way you don’t have to worry about browser or its version. You are only checking the browser feature.

var inputFile=document.createElement(“input”);

if(typeof inputFile.multiple!=”undefined”) return “Supports Uploadifive!”;
else return “Supports Uploadify!”;


Escape strings issue universal fix

Escape strings #onebigissue in programming, My solution works for all.

Say I have a textarea field “notes”

To encode all the special characters for passing the data, you’ll need to use “encodeURIComponent()”.
The encodeURIComponent doesn’t encode ~!*()’
To encode the remaining i have a function to replace single quotes in an encoded string.

function encodeURIComponentReplace(encodeString){
  //encodeURIComponent() will not encode: ~!*()' - use this function to do the job	
  var intIndexOfMatch = encodeString.indexOf( "'" );
  while (intIndexOfMatch != -1){
    encodeString = encodeString.replace( "'", "%27" )
    intIndexOfMatch = encodeString.indexOf( "'" );
  return encodeString;

If you send the parameters in GET method to PHP backend,
you’ll receive parameter values with added slashes.
You should strip slashes and convert the htmlentities before database insert/update.


If you send the parameters in POST method you do not have to do the above step.

Retrieving the data from the database using PHP.

If you are simply echoing values from the database to front-end use the following PHP code:

If you are sending values in a json array do the following before encoding:
then json_encode the output array.