I have added the following rule to .htaccess  RewriteCond %{HTTP_HOST}   !^example\.com [NC] RewriteCond %{HTTP_HOST}   !^$ RewriteRule ^/(.*)         http://www.example.com/$1 [R=301,NC,L]   I suppose it says that if url is not example.com, redirect it to www.example.com.   I need to do this as I have a Cname example.rhcloud.com and is mapped to www.example.com. But I still can access example.rhcloud.com and is being indexed by Google as well. I certainly do not want my data to be available on 2 different domains and want example.rhcloud.com to be redirected to www.example.com  With above rewrite rule, it does nothing and gives access to example.rhcloud.com.  I also tried using   RewriteCond %{HTTP_HOST} ^example.rhcloud.com$ RewriteRule (.*)$ http://www.example.com/$1 [R=301,L]   But it says too many redirects as it try and retry to connect to example.rhcloud.com.  How do I have this redirect work?  Also, If that makes any difference, I have added WordPress URL and site URL set to www.example.com only.
Openshift application url: example.rhcloud.com  Custom domain: example.com  I came across this  and added the redirection rule. However, I can not access example.rhcloud.com now. My custom domain is www.example.com.  To avoid duplicate content problems, I tried this redirection.   Here is my .htaccess file:  RewriteEngine on   # Uncomment the following lines to force HTTPS #RewriteCond %{HTTP:X-Forwarded-Proto} !https  #RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R,L]   # WordPress Defaults RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]  # Redirect Https traffic to Http RewriteEngine on  RewriteCond %{SERVER_PORT} ^443$ [OR] RewriteCond %{HTTPS} on RewriteRule  ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]   # Redirect non-www to www RewriteEngine on  RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]    # Redirect openshift rhcloud domain to custom domain RewriteEngine on  RewriteCond %{HTTP_HOST} ^example.rhcloud.com$ RewriteRule (.*)$ http://www.example.com/$1 [R=301,L]   Why is example.com not redirecting to ww.example.com? How do I fix this?  Also, I see that since I have https to http redirection and non www to www redirection, my blog has been loading slow. How can I reduce it to lesser number of rules?  Edit:  In chrome:   In Firefox:     The page isn't redirecting properly, Firefox has detected that the server is redirecting the request for this address in a way that will never complete.     This problem can sometimes be caused by disabling or refusing to accept cookies.
How to make a redstone clock that I can turn on/off with a lever? I want to create a Redstone clock that can be enabled and disabled with a lever permanently placed down. Allow users to put their e-mail in posts? Should I edit out the (thankfully obsfucated) e-mail address from this ?  Is this something we should allow on the site going forward?  I don't care about the "thank you" or "hello", but this might lead to an answer being sent by e-mail, which would mean it wouldn't be peer reviewed (for what that's worth), and the answer would be lost to the community. Can I install Windows OS (Windows 7) on a removable USB hard drive? I wanted to take a sneak peek at Windows 7 so I thought of installing it. I have Windows Vista on my laptop which came pre-installed with it. I didn't want to mess with it.  So I created a partition (20 GB) in my USB external hard disk and tried to install Windows 7 on that partition. But when I booted from a Windows 7 DVD and selected the target partition on USB hard disk, it said it cannot be installed.  Is there any way to install Windows on an external USB hard disk? Probability of student passing an exam There're $25$ tests, each with $2$ questions. There're total of $50$ different questions (the questions do not repeat). The student knows the answer of $44$ questions. To pass the exam, the student needs to correctly answer both questions on the first test he drew, or answer $1$ question from the test he drew first, and $1$ question from the test he drew second. (meaning he draws twice if he answers a question incorrectly on his first try)  What is the probability that the student will pass the exam?  I have never faced a problem like this one so any help is appreciated. I was thinking about approaching it "manually" with some applied combinatorics but I feel like there's a much easier way that I am not familiar with. Sum over multiple indices Subdividing a beveled mesh creates new vertices in wrong places Moving from SQL 2005 [SQL_Latin1_General_CP1_CI_AS] to 2008 - will I lose any features by using 'backwards compatibility' We're moving from SQL 2005 [Instance and DB have collation of SQL_Latin1_General_CP1_CI_AS]  to SQL 2008 [which defaults to Latin1_General_CI_AS].  I completed a SQL 2008 R2 installation, and used default Latin1_General_CI_AS collation, with the restoration of the database still on SQL_Latin1_General_CP1_CI_AS. The excepted problems occurred - the #temp tables where in  Latin1_General_CI_AS whilst the db was in  SQL_Latin1_General_CP1_CI_AS and this is where I am now - I need advice on the pitfalls now please.  On installation of SQL 2008 R2, I have the option on installation to use 'SQL Collation, used for backwards compatibility' where I have the option to select the same collation as the 2005 database : SQL_Latin1_General_CP1_CI_AS.   This will allow me to not have problems with #temp tables, but are there pitfalls? Would I lose any functionality or features of any kind by not using a "current" collation of SQL 2008? What about when we move (e.g. in 2 years ) from 2008 to SQL 2012? Will I have problems then? Would I at some point be forced to go to Latin1_General_CI_AS? I read that some DBA's script complete the rows of complete databases, and then run the insert script into the database with the new collation - I'm very scared and wary of this - would you recommend doing this? How do I wrap text with no whitespace inside a ? Following an earlier question ,  I would love to implement the  as suggested by Russell McMahon.   That way I could switch between 4AA batteries (1.2V*4 or 1.5V*4) and USB power. The battery voltage would nicely be regulated to 5V too. And the idea was to use the shutdown pin of the chip IF USB power is detected. The device also has to work when no batteries are present.  I am not too experienced with this, but I thought to connect the 5V from the USB to the SHUTDOWN pin from the LDO chip. Pitywise, the pin function is inverted, if SHUTDOWN is low, Vout from the LDO chip is low.  I am now considering using an XOR gate to make the thing work:         &ndash; Schematic created using   I would love to limit the amount of components, but the number of diodes is already high, and the whole thing feels a bit crafted   My questions:    Is there a better suitable chip (with an inverted shutdown pin) is there a better circuit (without voltage drop) to get this (I would prefer to get rid of D1, but then, the XOR has no desired operation) How can I list permissions of every component in a file path? Sometimes it is necessary to determine on which directory in a path access rights are limited. Here is an example:  $ ls /sys/kernel/debug/usb/devices ls: cannot access /sys/kernel/debug/usb/devices: Permission denied $ cat /sys/kernel/debug/usb/devices cat: /sys/kernel/debug/usb/devices: Permission denied   Neither ls nor cat shows where the user rights were limited.  What is the simplest way of showing the access rights for every component (directory and the file) in the path? I am mainly interested in solutions for Unix-like systems. I don't understand why su - is preferred over su to login as root. I'm trying to to execute a script, which uses the command rename.   When I execute it, I get a message rename: command not found. Any ideas?   if [[ -z '$3' ]]; then     shopt -s dotglob     rename "$EXPRESSION" ./* else     rename "$EXPRESSION" "$3" fi Windows 7 File Explorer search not working Why Java needs Serializable interface? We work heavily with serialization and having to specify Serializable tag on every object we use is kind of a burden. Especially when it's a 3rd-party class that we can't really change.  The question is: since Serializable is an empty interface and Java provides robust serialization once you add  implements Serializable - why didn't they make everything serializable and that's it?    What am I missing? I have a map of an area and georeferenced photos. I need to be able to bring the pictures as points and then be able to click at a certain point and an image pop up.   I have revisited this issue, i managed to get this far but the pop up doesn't work.   See image: What is the dot product and why do we need it? I understand how to calculate the dot product of the vectors. But I don't actually understand what a dot product is, and why it's needed.  Could you answer these questions? Using MSSQL2005, can I truncate a table with a foreign key constraint if I first truncate the child table (the table with the primary key of the FK relationship)?  I know that I can either   Use a DELETE without a where clause and then RESEED the identity (or) Remove the FK, truncate the table, and recreate the FK.   I thought that as long as I truncated the child table before the parent, I'd be okay without doing either of the options above, but I'm getting this error:     Cannot truncate table 'TableName' because it is being referenced by a FOREIGN KEY constraint. Motivation for spectral graph theory. Notify users of a question they closed being edited or nominated for reopening How to deal with "java.lang.OutOfMemoryError: Java heap space" error?