Howto: Configure cloudflare for wordpress

My web hosting company don’t support subdomain SSL certificates. And because Google’s Chrome in July is required HTTPS on all websites (otherwise you get an error your website isn’t safe) I had some deadline to make my blog HTTPS. Cloudflare is a nice reverse proxy solution and the basic plan is free to use also.

So what I did was create a cloudflare account and put my website behind it. After I did that I forced the HTTPS and voila my website was HTTPS. The steps you must take.

Note: this trick will also work if you want to use cloudflare as a reverse proxy to prevent DDoS, to optimize your site security, hide your hosting party backend and make your website a lot faster. If you use a raspbery Pi for example at your home location you can put cloudflare between the visitor and your home IP and save you a lot of trouble.

  • If you use the wordfence plugin also be sure your PHP version is higher than 5.6. Otherwise you get some errors and conflicts (more info)
  • Go to cloudflare an create an account
  • Configure your DNS

  • (temporary) disable your DNSSEC at you domain if that is enabled (cloudflare cannot succesfully transfer your DNS otherwise). For me I had to create a ticket with my domain register company
  • Cloudflare give you 2 new name servers. Ask your domain registry company to change these DNS name servers if you can change it by yourself

  • After a succesfull DNS nameserver change cloudflare shows in the portal everything is ok:

  • Optimize your cloudflare for wordpress in the cloudflare wordpress plugin and enable HTTPS rewrites

  • Now edit your url in the settings >general in your wordpress

  • And finaly go to cloudflare and enable always uses HTTPS under crypto

Now everything is done and your website is fully HTTPS at the frontend (with automatic HTTP > HTTPS URL rewrites). Because my backend don’t have an SSL certificate all the data between cloudflare and my hosting company is still unencrypted. So this is a nasty workaround but you don’t have any problem with Chrome HTTPS problems in the near future anymore.

How to change a WordPress site URL

Sometimes you may need to change the URL of your WordPress site.

For example, it is a common practice to develop the new version of your site in a subfolder and when it is ready to move it into your root directory.

WordPress, however, relies on its URL settings to work correctly.

This means that if you simply move your files and database it will not work properly.

The URL settings are located in the application database. Fortunately, direct database modification can be avoided by using a nice function provided by the WordPress developers named “update_option”.

Simply add these lines to the functions.php file of your theme:

update_option('siteurl','http://www.new-site-address.com');
update_option('home','http://www.new-site-address.com');

wordpress-change-url

Then simply load your site from its new location – it should work just fine.

Note that after you run your site once and you make sure it works you should delete those lines from your functions.php file. The settings are already stored in your database and should not be modified each time your site is loaded.

Source (sorry ordinary copy/past): http://www.siteground.com/tutorials/wordpress/change-url.htm

Write code in your wordpress page

[banner]

Sometimes you want to put code in your wordpress blog. The beste way to write code is switch to switch to HTML and put the <code> and </code> tags to your post.

Example with <code>:


mailq | tail -n +2 | grep -v '^ *(' | awk  'BEGIN { RS = "" } { if ($7 == "[email protected]") print $1 } ' | tr -d '*!' | postsuper -d -

Example withoute <code>:

mailq | tail -n +2 | grep -v ‘^ *(‘ | awk  ‘BEGIN { RS = “” } { if ($7 == “[email protected]”) print $1 } ‘ | tr -d ‘*!’ | postsuper -d –

You will see that some characters won’t display correctly if you don’t use the code tag.

Another/better way to publish code is using the “SyntaxHighlighter Evolved” plugin.

Example:

mailq | tail -n +2 | grep -v '^ *(' | awk  'BEGIN { RS = "" } { if ($7 == "[email protected]") print $1 } ' | tr -d '*!' | postsuper -d -

And if you need special characters in your post try these:

< = &lt;
> = &gt;
/ = &#47;  	
] = &#93;
[ = &#91;
" = &#34;
' = &#39;

And if you want to use a code language try these

[code language="sql"]
your code here
[/code]

The following languages are supported:

actionscript3
bash
clojure
coldfusion
cpp
csharp
css
delphi
erlang
fsharp
diff
groovy
html
javascript
java
javafx
matlab (keywords only)
objc
perl
php
text
powershell
python
r
ruby
scala
sql
vb
xml

SQL script Example:

USE database;
SELECT * FROM Persons
WHERE City='Sandnes'

Last but not least. DO NOT USE THE VISUAL VIEW 🙂 Visual will scramble your code.

[banner]

Create new themes with Artisteer

Today is was time for a new WordPress skin/theme. I search the default wordpress themes but without success. Then I tried Artisteer. I used it for a Joomla theme once and it is very easy to create nice looking theme for WordPress, Joomla and Drupal.

If you can work with Office 2007 and above you can create themes 🙂

Check screen: