3 June 2018

Links not working after cloning WordPress site, .htaccess ok, wtf?

Ok so I:

Migrated a Wordpress site from one host to another

Pretty simple, moved all the files to the new host, kept the same directory structure, kept the same database user names and passwords and copied the MySQL database over. Site loads, everything is great.

Every link is getting a error 404 page

Oh, did I copy across the .htaccess file? Yes. Cue 30 minutes of head scratching checking the new server is Apache on not nginx, stripping the .htaccess to the most basic version allowing a WordPress multisite.

I remembered! httpd.conf Sure enough, I looked under up the server's httpd.conf and in the section pertaining to /var/www/ there was 'AllowOverride none', meaning it ignored all those rules in .htaccess - I change this line to:

AllowOveride All

And it works! Simple, simple.

17 February 2015

O2 MMS Settings on Jolla Phone

I have an O2 pay monthly SIM and a Jolla phone (JP-1301) running Sailfish OS. I needed to reinstall MMS settings so sent 'ACTIVE' to 2020 as they advise and was greeted with a return text message stating: "Unfortunately we had problems dealing with your requset for settings. Please contact Customer Service". Now, I've dealt with customer service enough times to know how this would pan out: "Yeah, it says here your device doesn't have MMS capabilities so there's no settings for it" being a likely outcome. So I poked through some other devices and tried a few variations of the settings I found. The following worked for me:

Go to: Settings > System > Mobile network > MMS access point

And enter the following settings:

Connection Name: O2 MMS postpay
Access point name: mobile.o2.co.uk

Security
Username: o2web
Password: password

Proxy
Proxy address: 82.132.254.1
Proxy port: 8080

MMS message centre
MMS message centre address: http://mmsc.mms.o2.co.uk:8002

11 March 2014

Fixing XMPP problem after updating Flamingo IM

I've just updated the Flamingo app and found it couldn't connect to my custom XMPP server, despite having the details correct. Turns out, it failed to connect because I have a 'self signed' SSL certificate. Would have been nice to have an error message! Anyway, getting around this is trivial. Open a new Terminal window and enter:
defaults write com.nonatomic.Flamingo AllowSelfSignedCertificates -bool true
I restarted Flamingo and was able to connect straight away. Obviously, you have now an issue where Flamingo will connect to any server with a self-signed certificate, so only do this if you're aware of the risk. This post originally appeared on SimonCoopey.net: http://coopey.me/p-AUy

3 December 2013

Debian / Ubuntu Postfix Error: Diagnostic-Code: X-Postfix; unknown user:

I've just set up a new Debian/Ubuntu server, and had a problem with Postfix rejecting mail.  Mails were getting returned to sender with the error:

Diagnostic-Code: X-Postfix; unknown user: "admin"

From the command line, I opened the Postfix config file:

vi /etc/postfix/main.cf

Then I found the line:

mydestination = example.com, localhost, localhost.localdomain

(where example.com was the server address) and changed it to:

mydestination = localhost, localhost.localdomain

I saved the file (:wq) and restarted Postfix:

service postfix retstart

Emails started arriving! I believe that the original format confuses Postfix- instead of trying to find and deliver to the local mailboxes, it tries to forward them on to example.com perhaps?

24 June 2013

Uninstall Copy (copy.com) in Mac OS X (10.8)

I tried 'Copy' (or click this link for +5GB free), and while the generous storage quota was appealing and the service worked fine generally, I didn't like the Mac OS X client.
It prompted me to log in on every start up, a big hassle when you use super-long randomly generated passwords. On the other hand, Box and Dropbox both work away in the background without needing any assistance.
Also, it put an unexpected and unwanted extra menu option on the right-click menu which I was not too happy about.

First, exit Copy from the menubar; Then delete the application from the Applications folder.

Then, to get rid of the extras Copy installs, run these commands in Terminal:

sudo rm -rf "/Library/Application Support/Copy Agent"

and:

rm -rf "~/Library/Application Support/Copy Agent"

Sorted.

7 May 2013

Removing hard-coded social share buttons on Adelle theme

An acquaintance of mine, Rachael Phillips, has a blog and uses the nice Adelle theme from Bluchic.  Bluchic don't offer support for the theme (fair enough, as it's given away for free), and the WordPress forums were little help with a small problem Rachael had with the theme.
She has added a social sharing plugin, but the Adelle theme has its own social sharing buttons hard-coded in to the theme. So there is some duplicity in post footers:

I thought that the 'Tweet' and 'Like' buttons would be quite easy to get rid of, by adding "display: none;" to relevant classes in the style.css file. This worked for the Tweet button, but the 'Like' button stubbornly remained. In the end, I opted to edit the relevant files directly as this seemed like the quickest  option.

To remove the hard-coded social buttons you need to edit the following files:
content.php
content-list.php
single.php

In each of these files, look for the footer:

    <footer class="post-footer">
      <ul class="post-info-meta">
        <li>
          <a href="<?php echo esc_url('https://twitter.com/share'); ?>" class="twitter-share-button" data-url="<?php the_permalink() ?>" data-count="horizontal">Tweet</a><script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
        </li>
        <li>
          <div class="fb-like" data-href="<?php the_permalink() ?>" data-send="false" data-layout="button_count" data-width="100" data-show-faces="false"></div>
        </li>
        <li class="post-info-comment"><div class="post-comment"><?php comments_popup_link( __('0 comment','adelle-theme'), __('1 Comment','adelle-theme'), __('% Comments','adelle-theme') ); ?></div></li>
      </ul>
    </footer><!-- .post-footer -->

You want to find the following lines...

        <li>
          <a href="<?php echo esc_url('https://twitter.com/share'); ?>" class="twitter-share-button" data-url="<?php the_permalink() ?>" data-count="horizontal">Tweet</a><script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
        </li>
        <li>
          <div class="fb-like" data-href="<?php the_permalink() ?>" data-send="false" data-layout="button_count" data-width="100" data-show-faces="false"></div>
        </li>

...and simply remove them.

Save each file, and upload into the /adelle/ folder, replacing the existing files.

If you don't want to edit files, or are worried about editing the files yourself, you can download them here:[removed! so old now]

29 April 2013

Diverting visitors from a specific IP address to another website

I don't like certain companies or people looking me up. UK company A4e is one I most definitely don't want to be associated with, and I do not fancy them looking up my CV website- but I found visitor records suggesting that someone at the company has.  Obviously, this is a public page and doesn't contain much in the way of personal information- its purpose is to help people who have worked with me track me down, or people who get an email from me on a professional level look up more about me. What it is not for is the likes of A4e to data-mine and use my information for any of their purposes. So I set out to block any repeat visits, with a redirect to a page that says why.

This seems to be quite easy to accomplish with .htaccess.  To block someone from a specific IP address add the following to a .htaccess file: (or append it to an existing one, taking care not to delete important existing rules)

RewriteEngine On 
RewriteCond %{REMOTE_ADDR} ^195\.171\.111\.196
RewriteRule .* http://goaway.coopey.me [R,L] 

If you wanted to block a whole range of IP addresses use '.$' e.g. to block the range 195.171.111.* use the following for line two:

RewriteCond %{REMOTE_ADDR} ^195\.171\.111\.$ 

If you wanted to block a subsection, use the following format: (this will block 195.171.111.16 to 195.171.111.32)

RewriteCond %{REMOTE_ADDR} ^195\.171\.111\.(1[6-9]|2[0-9]|3[0-2])$

The IP address 195.171.111.196 in this example seems to be A4e's fixed IP from their head office in Sheffield. The page goaway.coopey.me is hosted at Tumblr, and says 'Access Denied' with a short explanation why.

Remember, this will only work on visitors from a specific IP (or range of IPs). If you block a range, you may be blocking more people than you attended, and if you block someone who uses a dynamic IP address (their ISP changes this each time they connect to the internet) then they will not be permanently redirected- and the people who are subsequently assigned the IP will have to access!

19 September 2012

Check CentOS Version

Ever go to install a package, but can’t remember which specific version of CentOS you’re running? This often happens to me, and helpfully I can never remember the command. So for as much my benefit as yours, this is what you do:

Run:


cat /etc/redhat-release

which will return your version number, eg:


CentOS release 5.8 (Final)

Edit:

The command:


cat /etc/centos-release

works in CentOS 6.

Changing root password in CentOS

If you want to change the default root password in CentOS, it’s one simple command: (assuming you’re logged in as root)


passwd

You’ll have to enter your new password twice:


Changing password for user root.
New UNIX password: 
Retype new UNIX password:

If they match, you’ll get the message:


passwd: all authentication tokens updated successfully.

All done!

If you need help generating a random and secure password, try passwordsite.co.uk





via Simon Coopey » Development http://simoncoopey.com/2012/changing-root-password-in-centos/#utm_source=feed&utm_medium=feed&utm_campaign=feed

28 April 2012

Moving home...

Well not home, but this blog.

The content has been merged in with my main blog at coopey.si

Some of the content seemed better suited kept separate. So I kept the short 'tidbits' here, and moved the longer posts there.