Archive for the ‘Programming’ Category

Forcing ssl to particular page and non-ssl to other pages

March 14th, 2013 2 comments

In projects we may need to make sure some of the urls are only accessible from ssl (https). It’s really useful for user sections. And rest of the url should browse from non-ssl (http) link. It can be done with a small htaccess rules.

Here is htaccess hack to do:

#SSL for some pages
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_FILENAME} !index\.php$ [NC]
RewriteCond %{REQUEST_URI} ^/(signin|signup|account) [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

In this block we are checking for ssl off and some url, if match we redirect the user to same url in ssl version.

#SSL off for some pages
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_FILENAME} !index\.php$ [NC]
RewriteCond %{REQUEST_URI} !^/(signin|signup|account) [NC]
RewriteCond %{REQUEST_URI} !^/(api) [NC] #allow this url from both ssl and non-ssl
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

In this block we are checking for ssl on and some url, if match we redirect the user to same url in non-ssl version. Here u may notice we are using a extra check ( RewriteCond %{REQUEST_URI} !^/(api) [NC] ) , it’s because in project we may need some url those accisable from both ssl and non-ssl.

hurraaaaaaaaaa I got phpED 5.0

May 17th, 2007 4 comments


At last I got my phpED (license copy). Thanks goes to Hasin Hayder.

Hope it will help me to make batter experience with PHP.

Soon i will write review on phpED 5.0

Categories: My Computer, My Works, PHP, Programming Tags:

my statistics on acm

October 10th, 2006 No comments
Categories: My Works, Personal, Programming Tags:

Google Coding contest

September 3rd, 2006 No comments

If you are a programmer, don’t forget to try this link 🙂

Categories: C/C++, Java, Programming Tags:
60 queries in 0.087 seconds