Skip to content

Introduction

This Jussi's private notepad on things technical. Hope it helps someone else, too.

(This text is shown with the aid of blog introduction plugin without touching the theme files.)

301 Redirect [PHP]

03-Feb-10

<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.example.com/new-url/");

Done. PHP 301 redirect is now rolling in given directory once you put that, say, in a file named index.php.

JavaScript to Footer in WordPress

20-Jan-10

Want to move that jQuery and other js references from header to footer? Try JavaScript to Footer plugin.

Cookie-free JS, CSS, etc for Wordpress

15-Jan-10

These 3 steps will help you to set up cookie free JavaScript, CSS and other files for your WordPress installation. (This is especially helpful for changing the domain of certain JS/CSS file references added by plugins.)

Before you start, make sure your blog URL has a leading www (e.g. www.example.com, not example.com). (Cookie-tech-stuff)

Step 1) Create a sub-domain pointing to your real web root (e.g. static.example.com).

Step 2a) Install CDN Rewrites plugin. (Did not work for me, so I had to revert to another way). If this is you as well, enter step 2b.1.

Step 2b.1) Install Free CDN plugin. Change its settings if you want to.

Step 2b.2) Edit /wp-content/plugins/free-cdn/free-cdn.php.

Find

if (isset($parts['port']))
{
$parts['host'] .= '.$parts[port].nyud.net';
unset($parts['port']);
}
else
{
$parts['host'] .= '.nyud.net';
}

around line 282. Right after this add:

$parts['host'] = 'static.example.com'; // my own edit

and make sure the domain matches the one you set up in step 1.

If you want to keep your edit safe, change the version number of the plugin to something like "1200" (at the beginning of the file) so that WP won't suggest updating the plugin.

Cell Reference to Excel Header / Footer [Only VBA will do]

12-Jan-10

The only way: use a VBA macro. E.g.

ActiveSheet.PageSetup.LeftFooter = "Check: " &  Sheets(SETTINGS_SHEET_NAME).Range("F4").Value

Line Break in Excel Header / Footer via Macro

11-Jan-10

Using VBA, add line break to header or footer with Chr(13).

E.g.

ActiveSheet.PageSetup.LeftFooter = "Foo bar" & Chr(13) & "Another line"