Quarter Pie Interactive on ‘Code Snippets’


Block Bots using robots.txt File

All of us come across a stage when we want to check the website but we do not want the Search Engines to crawl the website for one reason or another. Some times because we are using dummy content from another website so we do not want to get penalized for duplicate content, some times because we are using Lorem Ipsum and we do not want the search engines to index those pages. Here is a something that needs just a text editor, any will do and access to upload a file on the server. All this needs is, robots.txt file ...

» continue reading

Moving WordPress Across Domains

Easy way to Move Wordpress based Website URL I did face this problem when I had to move a client website across three servers while development and then to the live server. I had to Google to find a solution for this so this article in no way means that I developed or figured out this process to move website across servers but yes I did some tweaking on the process that I found so that its easy for anyone who knows a little about MySQL or atleast knows how to get into cpanel and then on to the database which ...

» continue reading

Force SSL (HTTPS) using mod_rewrite

This is a simple snippet that is often required and helpful for eCommerce Websites running off a linux server using mod_rewrite. If you have a client who wants the entire website to work with the SSL Padlock ON. You can use these lines in your .htaccess files to force a redirect to https which works off port 443 instead of http which works on port 80. RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

» continue reading

Copy Table and Data Across SQL Server Tables

One of my recent projects needed some tables to be moved to a new database from another existing database. The only way I knew its possible is using the Import/Export wizard from the days of SQL Server 2007. Now this server has SQL Server Express Edition which comes with SQL Server Management Studio Express so I had to do it by queries as there was no Wizard for help. The SQL I found to move MS SQL database tables across databases on same server worked and it was as below SELECT * INTO destinationdbname.dbo.tblUsers FROM sourcedbnamecrm.dbo.tblUsers This worked but however it did not ...

» continue reading

Local Timestamp in PHP : Indian Sample Code

Local Timestamp in PHP Recently I was stuck with one of the assignments which required Local Indian Timestamp to be inserted into database and was not able to find anything better than this even after much googling. I hope you find this useful and if there is a better way, Please let me know and I will update this post. I know there is a better way with PHP 5.3+ but this had to work on a lower version. <?php /* * Function to turn a mysql datetime (YYYY-MM-DD HH:MM:SS) into a unix timestamp * @param str *  The string to be formatted */ function convert_datetime($str) { list($date, $time) = ...

» continue reading