<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dream House &#187; Tips &amp; Tricks</title>
	<atom:link href="http://sajjadhossain.com/category/tips-tricks/feed/" rel="self" type="application/rss+xml" />
	<link>http://sajjadhossain.com</link>
	<description>Courage to do something...</description>
	<lastBuildDate>Sun, 07 Nov 2010 06:45:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>SSL (HTTPS) URLs and CodeIgniter (Extending the core)</title>
		<link>http://sajjadhossain.com/2010/08/18/ssl-https-urls-and-codeigniter-extending-the-core/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://sajjadhossain.com/2010/08/18/ssl-https-urls-and-codeigniter-extending-the-core/#comments</comments>
		<pubDate>Wed, 18 Aug 2010 17:25:54 +0000</pubDate>
		<dc:creator>Mohammad Sajjad Hossain</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://sajjadhossain.com/?p=241</guid>
		<description><![CDATA[In one of my previous post I have shown how we can use both secure and non-secure URLs. Now I am going to show how we can do this, extending native libraries. What we are going to do&#8230; We will create secure version of some functions. For this we will create a helper file &#8216;my_url_helper.php&#8217; [...]
Related posts:<ol>
<li><a href='http://sajjadhossain.com/2008/10/27/ssl-https-urls-and-codeigniter/' rel='bookmark' title='SSL (HTTPS) URLs and CodeIgniter'>SSL (HTTPS) URLs and CodeIgniter</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div><img class="alignleft size-full wp-image-111" title="ci_logo_flame" src="http://sajjadhossain.com/wp-content/uploads/2008/10/ci_logo_flame.jpg" alt="ci logo flame SSL (HTTPS) URLs and CodeIgniter (Extending the core)" width="63" height="69" />In one of my previous <a href="http://sajjadhossain.com/2008/10/27/ssl-https-urls-and-codeigniter/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed" target="_blank">post</a> I have shown how we can use both secure and non-secure URLs. Now I am going to show how we can do this, extending native libraries.</div>
<div><strong>What we are going to do&#8230;</strong></div>
<div>We will create secure version of some functions. For this we will create a helper file &#8216;my_url_helper.php&#8217; and save it in &#8216;system/application/helpers&#8217;. We will be creating secure version of following functions:</div>
<div>
<ul>
<li>site_url()</li>
<li>base_url()</li>
<li>anchor()</li>
<li>redirect()</li>
</ul>
</div>
<div>Lets&#8217; start&#8230;</div>
<div>First we will add the following config element in the config file:</div>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'secure_base_url'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'https://example.com'</span><span style="color: #339933;">;</span></pre></div></div>

<div>Then, open the my_url_helper.php file (system/application/helpers/my_url_helper.php) and add the following codes.</div>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'secure_site_url'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">function</span> secure_site_url<span style="color: #009900;">&#40;</span><span style="color: #000088;">$uri</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$CI</span> <span style="color: #339933;">=&amp;</span> get_instance<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$CI</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">secure_site_url</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$uri</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'secure_base_url'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">function</span> secure_base_url<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$CI</span> <span style="color: #339933;">=&amp;</span> get_instance<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$CI</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">slash_item</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'secure_base_url'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'secure_anchor'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">function</span> secure_anchor<span style="color: #009900;">&#40;</span><span style="color: #000088;">$uri</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$title</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$attributes</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$title</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>string<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$title</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$uri</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$secure_site_url</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'!^\w+://! i'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$uri</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> ? secure_site_url<span style="color: #009900;">&#40;</span><span style="color: #000088;">$uri</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$uri</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">else</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$secure_site_url</span> <span style="color: #339933;">=</span> secure_site_url<span style="color: #009900;">&#40;</span><span style="color: #000088;">$uri</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$title</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$title</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$secure_site_url</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$attributes</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$attributes</span> <span style="color: #339933;">=</span> _parse_attributes<span style="color: #009900;">&#40;</span><span style="color: #000088;">$attributes</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">.</span><span style="color: #000088;">$title</span><span style="color: #339933;">.</span><span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'secure_redirect'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">function</span> secure_redirect<span style="color: #009900;">&#40;</span><span style="color: #000088;">$uri</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$method</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'location'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$http_response_code</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">302</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">switch</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$method</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'refresh'</span>    <span style="color: #339933;">:</span> <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Refresh:0;url=&quot;</span><span style="color: #339933;">.</span>secure_site_url<span style="color: #009900;">&#40;</span><span style="color: #000088;">$uri</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                                <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">default</span>           <span style="color: #339933;">:</span> <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Location: &quot;</span><span style="color: #339933;">.</span>secure_site_url<span style="color: #009900;">&#40;</span><span style="color: #000088;">$uri</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #339933;">,</span> <span style="color: #000088;">$http_response_code</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                                <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #990000;">exit</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<div>Now, I will extend the Config library (system/libraries/Config.php). I assume that the sub class prefix is set as &#8216;MY_&#8217; in config file (system/application/config/config.php). Create a file &#8216;MY_Config.php&#8217; in &#8216;system/application/libraries&#8217; folder and save the file with following code.</div>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> MY_Config <span style="color: #000000; font-weight: bold;">extends</span> CI_Config
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">function</span> MY_Config<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        parent<span style="color: #339933;">::</span><span style="color: #004000;">CI_Config</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> secure_site_url<span style="color: #009900;">&#40;</span><span style="color: #000088;">$uri</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$uri</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$uri</span> <span style="color: #339933;">=</span> <span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$uri</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$uri</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">slash_item</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'secure_base_url'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'index_page'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">else</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$suffix</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'url_suffix'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span> ? <span style="color: #0000ff;">''</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'url_suffix'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">slash_item</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'secure_base_url'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">slash_item</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'index_page'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;|^/*(.+?)/*$|&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>1&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$uri</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #000088;">$suffix</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<div><strong>Now what we have&#8230;</strong></div>
<div>Now we have secured versions of those function. You may now use them as their insecured version. Enjoy coding <img src='http://sajjadhossain.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink SSL (HTTPS) URLs and CodeIgniter (Extending the core)" class='wp-smiley' title="SSL (HTTPS) URLs and CodeIgniter (Extending the core)" /> .</div>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fsajjadhossain.com%2F2010%2F08%2F18%2Fssl-https-urls-and-codeigniter-extending-the-core%2F&amp;title=SSL%20%28HTTPS%29%20URLs%20and%20CodeIgniter%20%28Extending%20the%20core%29" id="wpa2a_2"><img src="http://sajjadhossain.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="share save 120 16 SSL (HTTPS) URLs and CodeIgniter (Extending the core)"  title="SSL (HTTPS) URLs and CodeIgniter (Extending the core)" /></a></p><p>Related posts:<ol>
<li><a href='http://sajjadhossain.com/2008/10/27/ssl-https-urls-and-codeigniter/' rel='bookmark' title='SSL (HTTPS) URLs and CodeIgniter'>SSL (HTTPS) URLs and CodeIgniter</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://sajjadhossain.com/2010/08/18/ssl-https-urls-and-codeigniter-extending-the-core/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>301 (Permanent) redirection using .htaccess file</title>
		<link>http://sajjadhossain.com/2010/03/10/301-permanent-redirection-using-htaccess-file/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://sajjadhossain.com/2010/03/10/301-permanent-redirection-using-htaccess-file/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 05:55:23 +0000</pubDate>
		<dc:creator>Mohammad Sajjad Hossain</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[htaccess]]></category>

		<guid isPermaLink="false">http://sajjadhossain.com/?p=229</guid>
		<description><![CDATA[A few days back one of my project&#8217;s domain changed. The nature of this project was such that it provides URLs to it&#8217;s subscribers to use in their site for different purposes. As it has a huge user base, it was quite impossible to change the URLs already provided to the subscribers. That&#8217;s why I [...]
No related posts.]]></description>
			<content:encoded><![CDATA[<p><a href="http://sajjadhossain.com/wp-content/uploads/2010/03/301_htaccess_redirect.png#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed"><img class="alignleft size-full wp-image-234" title="301_htaccess_redirect" src="http://sajjadhossain.com/wp-content/uploads/2010/03/301_htaccess_redirect.png" alt="301 htaccess redirect 301 (Permanent) redirection using .htaccess file" width="220" height="300" /></a>A few days back one of my project&#8217;s domain changed. The nature of this project was such that it provides URLs to it&#8217;s subscribers to use in their site for different purposes. As it has a huge user base, it was quite impossible to change the URLs already provided to the subscribers. That&#8217;s why I searched for a solution which will redirect the subscribers to new domain. I knew HTACCESS files can provide this type of service. So, I searched web for a solution to this problem &#8211; 301 redirection with HTACCESS file. Then I found the following solution. Before I provide the solution, I just want to say I am not an expert of HTACCESS <img src='http://sajjadhossain.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile 301 (Permanent) redirection using .htaccess file" class='wp-smiley' title="301 (Permanent) redirection using .htaccess file" />  .</p>
<p>I have created .htaccess file with the following line to redirect any request to http://www.oldurl.com/ to https://www.newurl.com/.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">redirect 301 / https://www.newurl.com/</pre></div></div>

<p>The line stated above tells Apache server to redirect all request to http://www.oldurl.com/ will be redirected to https://www.newurl.com/using 301 permanent redirection. It worked fine.</p>
<p>After implementing the solution I faced another problem. The line of code was redirecting to only HTTPS irrespective of the request made to HTTP or HTTPS. This caused a problem for the pages which were non-secured, I mean shown via HTTP. These pages contain elements like CSS, JavaScript files, images etc. which are linked as HTTP. So, browsers started generating security warnings. Again I took help of Google and searched for a solution. After studying different problems I wrote the following lines of code in the .htaccess file and it worked.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule ^(.*)$ https://www.newurl.com/$1 [L,R=301]
RewriteCond %{HTTPS} !^443
RewriteRule ^(.*)$ http://www.newurl.com/$1 [L,R=301]</pre></div></div>

<p>The above code does a conditional redirection. If the request is made to HTTP then it redirects to HTTP and the same is for HTTPS.</p>
<p>FYI, my project is built with CodeIgniter and the redirection worked fine with it.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fsajjadhossain.com%2F2010%2F03%2F10%2F301-permanent-redirection-using-htaccess-file%2F&amp;title=301%20%28Permanent%29%20redirection%20using%20.htaccess%20file" id="wpa2a_4"><img src="http://sajjadhossain.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="share save 120 16 301 (Permanent) redirection using .htaccess file"  title="301 (Permanent) redirection using .htaccess file" /></a></p><p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://sajjadhossain.com/2010/03/10/301-permanent-redirection-using-htaccess-file/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Integration of Payment Gateways</title>
		<link>http://sajjadhossain.com/2009/06/22/integration-of-payment-gateways/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://sajjadhossain.com/2009/06/22/integration-of-payment-gateways/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 05:39:43 +0000</pubDate>
		<dc:creator>Mohammad Sajjad Hossain</dc:creator>
				<category><![CDATA[Presentations]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[integration]]></category>
		<category><![CDATA[payment gateway]]></category>
		<category><![CDATA[paypal]]></category>

		<guid isPermaLink="false">http://sajjadhossain.com/?p=183</guid>
		<description><![CDATA[Yesterday, June 21 2009, I had to give a presentation on payment gateway integration at our office. That&#8217;s why I prepared a slide show. I mainly tried to show how PayPal&#8217;s Direct Payment API calls are made. I have choosen this because this technique is also used by other payment gateways. As I have shown [...]
No related posts.]]></description>
			<content:encoded><![CDATA[<p>Yesterday, June 21 2009, I had to give a presentation on payment gateway integration at our office. That&#8217;s why I prepared a slide show. I mainly tried to show how PayPal&#8217;s Direct Payment API calls are made. I have choosen this because this technique is also used by other payment gateways. As I have shown the example based on PayPal, I called this session &#8211; &#8220;<a href="http://sajjadhossain.com/wp-content/uploads/2009/06/Integration-of-Payment-Gateways.rar#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">Integration of Payment Gateways, The PayPal Way</a>&#8220;. It gives a basic idea how we can make API calls for payment processing. I have quoted some texts and images from PayPal&#8217;s integration documents.</p>
<p><a title="Integration of Payment Gateways" href="http://sajjadhossain.com/wp-content/uploads/2009/06/Integration-of-Payment-Gateways.rar#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed"><img class="aligncenter size-full wp-image-185" title="Integration-of-Payment-Gateways" src="http://sajjadhossain.com/wp-content/uploads/2009/06/Integration-of-Payment-Gateways.jpg" border="0" alt="Integration of Payment Gateways Integration of Payment Gateways" width="500" height="375" /></a></p>
<p>You can download the presentation from <a title="Integration of Payment Gateways" href="http://sajjadhossain.com/wp-content/uploads/2009/06/Integration-of-Payment-Gateways.rar#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">here</a>. For PDF version, click <a title="Integration of Payment Gateways" href="http://sajjadhossain.com/wp-content/uploads/2009/06/Integration-of-Payment-Gateways.pdf.rar#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">here</a>.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fsajjadhossain.com%2F2009%2F06%2F22%2Fintegration-of-payment-gateways%2F&amp;title=Integration%20of%20Payment%20Gateways" id="wpa2a_6"><img src="http://sajjadhossain.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="share save 120 16 Integration of Payment Gateways"  title="Integration of Payment Gateways" /></a></p><p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://sajjadhossain.com/2009/06/22/integration-of-payment-gateways/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>What to do to put an HTML element on top of a Flash object</title>
		<link>http://sajjadhossain.com/2009/05/30/what-to-do-to-put-an-html-element-on-top-of-a-flash-object/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://sajjadhossain.com/2009/05/30/what-to-do-to-put-an-html-element-on-top-of-a-flash-object/#comments</comments>
		<pubDate>Sat, 30 May 2009 14:51:38 +0000</pubDate>
		<dc:creator>Mohammad Sajjad Hossain</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[html]]></category>

		<guid isPermaLink="false">http://sajjadhossain.com/?p=172</guid>
		<description><![CDATA[Many times this happens that in a page we have used a DHTML menu and a flash header and when we mouse over the menu, the menu could not be visible because of the flash object comes over the menu. Another situation could be &#8211; we used a block script and the page contains a [...]
No related posts.]]></description>
			<content:encoded><![CDATA[<p>Many times this happens that in a page we have used a DHTML menu and a flash header and when we mouse over the menu, the menu could not be visible because of the flash object comes over the menu. Another situation could be &#8211; we used a block script and the page contains a flash object and when the script is called the flash object could not be hide.<br />
<img class="aligncenter size-full wp-image-173" title="dhtml_flash_problem" src="http://sajjadhossain.com/wp-content/uploads/2009/05/dhtml_flash_problem.gif" alt="dhtml flash problem What to do to put an HTML element on top of a Flash object" width="488" height="297" /><br />
I faced these situations many times and searched web for a solution. Long ago I found a solution which worked for me to solve these problems and I am still using it.</p>
<p><strong>The solution</strong></p>
<p>If you are using an <code>object</code> tag, then add the following param in it.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;param name=&quot;wmode&quot; value=&quot;transparent&quot; /&gt;</pre></div></div>

<p>If you are using an <code>embed</code> tag, then use the following attribute in it.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">wmode=&quot;transparent&quot;</pre></div></div>

<p>I don&#8217;t know what these codes do <img src='http://sajjadhossain.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile What to do to put an HTML element on top of a Flash object" class='wp-smiley' title="What to do to put an HTML element on top of a Flash object" />  as I am not a flash expert, but they work. If anyone knows anything more about these codes then please share with us.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fsajjadhossain.com%2F2009%2F05%2F30%2Fwhat-to-do-to-put-an-html-element-on-top-of-a-flash-object%2F&amp;title=What%20to%20do%20to%20put%20an%20HTML%20element%20on%20top%20of%20a%20Flash%20object" id="wpa2a_8"><img src="http://sajjadhossain.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="share save 120 16 What to do to put an HTML element on top of a Flash object"  title="What to do to put an HTML element on top of a Flash object" /></a></p><p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://sajjadhossain.com/2009/05/30/what-to-do-to-put-an-html-element-on-top-of-a-flash-object/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

