Welcome Guest, Not a member yet? Register   Sign In
Changing website structure mid-development [SOLVED]
#1

[eluser]tommizzle[/eluser]
Hi guys,

Basically: I'm mid way through a project on a social networking site, and had already been given a spec of what to do in terms of structure.

We'll use 'john' as an example:

To get to someones profile: www.root.com/profile/john
This was also available from: www.root.com/john (redirected to www.root.com/profile/john)

Now, I was just told that that method is not very SEO friendly, as it duplicates content (not sure how accurate this is?), so they want all profiles to be available off the root only (e.g www.root.com/john).

My question to you guys is how easy would this be, considering I've already got a 'Profile' controller set up with a tonne of stuff in it. I know I could just bung everything in an if statement in the root, but I would feel SO dirty doing that, so any other suggestions are greatly appreciated.

Thanks guys,

Tom
#2

[eluser]BrianDHall[/eluser]
First, SEO advice is like statistics - 90% of it is made up on the spot or is flat out wrong. You can use canonical to elliminate this: http://googlewebmastercentral.blogspot.c...nical.html

I assume you'll be dealing with people who refuse to accept such things, so we'll pretend you have to do this anyway.

The short fix is to create a route rule so /john maps to profile/john, but there is no need to use a redirect. Just let /john be the url and process it, it won't help to redirect() to profile/john.

Next, you can get rid of /profile by intercepting it with a route and calling a redirect to force it over to the /username url if you really must. You would do best to redirect it using a code 301 redirect, page permanently moved. It's more search engine friendly than a pure redirect.

I think that handles it. I've generally found that trying to explain why something is a waste of time to someone who doesn't understand what they are talking about is a bigger waste of time than just placating them.
#3

[eluser]jdfwarrior[/eluser]
Survey says.... Routes.

This is just the condensed version of Brian's answer Smile
#4

[eluser]tommizzle[/eluser]
Thanks Brian - Helpful as always.

So I guess this will have to be done with regular expressions? ie: If not one of my core controllers(home/auth etc), then route to the profile controller?

Thanks

Tom
#5

[eluser]Phil Sturgeon[/eluser]
I have been in the same situation. Clients asking for things they "need" that just make life difficult with no real benefit to anyone.

There is another way to handle this that is a little more robust, and stops you having to put in routes for all your normal controllers. I'm too tired and pissed off to remember how and where I did it (MY_Router, possibly datbase call?), but take a look at the code and see if you can work it out.
#6

[eluser]tommizzle[/eluser]
The code of what?

I take it there isn't a way to load a different controller within an if statement? If so; that would be perfect.
#7

[eluser]tommizzle[/eluser]
bump! still can't find a solution Sad
#8

[eluser]tommizzle[/eluser]
Got it: $route['^((?!home|auth|friends|news)\S*)'] = "profile/$1";

Cheers
#9

[eluser]BrianDHall[/eluser]
[quote author="tommizzle" date="1257530572"]The code of what?

I take it there isn't a way to load a different controller within an if statement? If so; that would be perfect.[/quote]

You can use IF statements in routes, actually. You just conditionally set the route based on an if statement. I use such functionality for $_GET related routing without having to do toy with .htaccess, which I consider worrisome juju.
#10

[eluser]M4rc0[/eluser]
[quote author="tommizzle" date="1257543078"]Got it: $route['^((?!home|auth|friends|news)\S*)'] = "profile/$1";

Cheers[/quote]

Hi tommizzle,

I'm also looking for something like this.

So what happens if I go to profile/member, it will redirect to /member instead?
Or does that route takes care of both profile/member and /member ?

Thanks for sharing!




Theme © iAndrew 2016 - Forum software by © MyBB