Posts Tagged "programming"

301 redirect with htaccess

How to redirect web based page with .htaccess Following are the code to paste (be careful to write on .htaccess it can be messed up whole website if anything goes wrong) into .htaccess file 301 redirection for any domain : RewriteEngine On RewriteCond %{HTTP_HOST} !^www.olddomain.com RewriteRule ^(.*)$ http://www.newdomain.com [R=301,L] newdomainRewriteRule ^$ http://www.newdomain.com [R=301,L] RewriteRule ^index.htm$ http://www.newdomain.com [R=301,L] RewriteRule ^index.php$ http://www.newdomain.com [R=301,L] RewriteRule ^index.html$ http://www.newdomain.com [R=301,L] RewriteRule ^index.shtml$ http://www.newdomain.com [R=301,L] RewriteRule ^index.asp$ http://www.newdomain.com [R=301,L] RewriteRule ^default.asp$ http://www.newdomain.com [R=301,L] RewriteRule ^index.aspx$ http://www.newdomain.com…

Like to share it
Read More

Get the First Monday of the current Month or Get Last Day of Month or Get First Day of Month

Get the First Monday of the current Month or Get Last Day of Month or Get First Day of Month Get the First Monday of the current Month <?php function getFirstMonday($month,$year) { $num = date(“w”,mktime(0,0,0,$month,1,$year)); if($num==1) return date(“Y-M-ds”,mktime(0,0,0,$month,1,$year)); elseif($num>1) return date(“Y-M-d”,mktime(0,0,0,$month,1,$year)+(86400*(8-$num))); else return date(“Y-M-d”,mktime(0,0,0,$month,1,$year)+(86400*(1-$num))); } $month = date(“m”); $year = date(“Y”); // this will output current month’s First Monday echo getFirstMonday($month,$year); ?> Get the Last Day of current Month <?php echo date(‘d/m/y’,strtotime(“last Friday”,mktime(0,0,0,date(“n”)+1,1))); // you can replace your Day instead…

Like to share it
Read More

JavaScript – Increament function

<HTML><HEAD><TITLE>ABC</TITLE> <SCRIPT LANGUAGE=”JAVASCRIPT” TYPE=”TEXT/JAVASCRIPT”> <!– a = 23; function ad() { a = (++a); alert(a); } //–> </script> </HEAD> <BODY> <a href=”javascript:ad();” mce_href=”javascript:ad();” title=”Add more” name=”add”> Add More Records </a> </BODY></HTML> Shashi Dhar KumarShashi Dhar Kumar Experience in Web/software development including client server and implementation using PHP, XML, MySQL and SQL Server. Experience of working on Apache, Linux projects, Javascript, Ajax, Putty, FTP, Remote Connection, XML parsing, Mod-Rewriting, Payment Gateways and shipping modules, Trouble shooting and Manual Testing. https://www.shashidharkumar.in

Like to share it
Read More