Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Weird URL

Hi am doing some SEO and using a piece of software called pro.seomoz.org it has crawled my site and given me quite a few things to look at - one of which is some slightly strange URL's for example

http://www.plusonecreative.co.uk/our-work.php/chit-chat/chit-chat/chit-chat/chit-chat/chit-chat/chit-chat/accessibility.php

As far as I can see this page should not exist anywhere as my WP install (chit-chat) sits in the main root folder http://www.plusonecreative.co.uk/chit-chat

Can anyone pass any insight as to why this might be happening please.

G

2 Answers

Update - I have used a robots.txt file to block anything which is our-work.php/chit-chat

Although this does not answer my question of where these rouge files have come from - anyone any ideas?

G

Jim Hoskins
STAFF
Jim Hoskins
Treehouse Guest Teacher

So, you can visit /our-work.php or /our-work.php/ . The difference is the second one technically puts you in a new directory. Which has the implication that relative hrefs like "chit-chat" are relative to different levels. "/chit-chat" in the former case, "/our-work.php/chit-chat" in the latter.

This is compounded by the link to chit-chat containing another trailing slash, creating an even deeper url to which relative urls are later resolved.

A link to "chit-chat/" from "/our-work.php/chit-chat/" would be "/our-work.php/chit-chat/chit-chat/" which as you can immagine creates a loop that builds the url you see above.

The best way around this is to use absolute urls, such as "/chit-chat" and "/our-work.php" in links, so they won't build off their current directory. Using relative urls requires to much maintenance and is prone to errors.

The downside is you can't arbitrarily put the site in a sub directory and have it "just work", which is usually only an issue if you rely on putting different sites in different folders in your development environment (as opposed to using things like virtual hosts or independent http servers for each project)

Does that make sense?