//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value.
This is backwards. Unless you have a specific index file to work with? Typically its the other way around, you would map a more textual representation to that of using the id's or names. I don't recommend going the other way around.
The url will show what the user types in. You cannot force that to change, only where it goes. So if they type in ?id=14, that is where they go and what they will see. You can write a replacer in PHP to have it provide the links in an expanded format, but I wouldn't recommend hard coding that since that now requires that mod_rewrite be in use. Declare an environment variable in the <IfModule mod_rewrite.c> block, and alter the links as desired in PHP.
This is backwards. Unless you have a specific index file to work with? Typically its the other way around, you would map a more textual representation to that of using the id's or names. I don't recommend going the other way around.
The url will show what the user types in. You cannot force that to change, only where it goes. So if they type in ?id=14, that is where they go and what they will see. You can write a replacer in PHP to have it provide the links in an expanded format, but I wouldn't recommend hard coding that since that now requires that mod_rewrite be in use. Declare an environment variable in the <IfModule mod_rewrite.c> block, and alter the links as desired in PHP.
Ive done all the php work
This is for search engines and other sites that are linking to www.domain.co.uk/blog-article.php?id=14 to redirect to its new page which is search engine friendly.
You probably could make your rule to do it the other way around, but I don't see much point if you are trying to tidy things up and make them clearer, as you are actually munging things and making them less clear.
It's also worth mentioning that if the search engine is already listing:
Just adding to that, if you *really* want to do it (and for the sake of Google bringing people here):
The reason your version fails is because of the ? question mark ? You cannot use the question mark in the match as it signals a querystrings which is caught as separate data.
This basic example will do what you want for the specific URL quoted, but it can probably be better refined or optimised.
Just adding to that, if you *really* want to do it (and for the sake of Google bringing people here):
The reason your version fails is because of the ? question mark ? You cannot use the question mark in the match as it signals a querystrings which is caught as separate data.
This basic example will do what you want for the specific URL quoted, but it can probably be better refined or optimised.
I was told by someone from seomoz that to keep the pr4 rank for that page plus to keep google happy by the links still going to the relevant pages to 301 direct the old url to the new one.
Can someone please tell me why this is backwards?
Its only applying to what google are asking for is it not?
I'm no expert on Google metrics - so I'm not qualified to answer, but in a logical context I would look at it like this:
LINK GOES DIRECTLY TO RELEVANT CONTENT WITHOUT INTERVENTION
LINK = GOOD, KEEP IN INDEX
LINK GOES INDIRECTLY TO RELEVANT CONTENT VIA A REDIRECT
LINK = RUBBISH, NOT POINTING TO RIGHT PLACE, DROP/MODIFY
Effectively, and I stress as a LOGICAL problem, I don't want a link to something being redirected - I want to go direct to the resource, and I would penalise for a redirect (which means not only the link is effectively pointing to the wrong resource, but also resulting in more traffic to achieve the required result).
To square that, a redirect is probably useful if you move a page and want it re-indexed. However there will probably come a point where if you redirect the same resource for two long there may be a pay-off or penalisation metric.
I must stress, however, I know very little about SEO, I know about Apache. As far as SEO is concerned I've always been lucky enough to get sites listed and well placed in search engines by using clean, relevant content with properly formatted pages and targeting specific demographics for the business concerned, but I know others who have more general sites in swamped sectors have an uphill battle.
I'm no expert on Google metrics - so I'm not qualified to answer, but in a logical context I would look at it like this:
LINK GOES DIRECTLY TO RELEVANT CONTENT WITHOUT INTERVENTION
LINK = GOOD, KEEP IN INDEX
LINK GOES INDIRECTLY TO RELEVANT CONTENT VIA A REDIRECT
LINK = RUBBISH, NOT POINTING TO RIGHT PLACE, DROP/MODIFY
Effectively, and I stress as a LOGICAL problem, I don't want a link to something being redirected - I want to go direct to the resource, and I would penalise for a redirect (which means not only the link is effectively pointing to the wrong resource, but also resulting in more traffic to achieve the required result).
To square that, a redirect is probably useful if you move a page and want it re-indexed. However there will probably come a point where if you redirect the same resource for two long there may be a pay-off or penalisation metric.
I must stress, however, I know very little about SEO, I know about Apache. As far as SEO is concerned I've always been lucky enough to get sites listed and well placed in search engines by using clean, relevant content with properly formatted pages and targeting specific demographics for the business concerned, but I know others who have more general sites in swamped sectors have an uphill battle.
As the page of blog-article?id=14 was moved to a seo friendly url is that not a reason for a redirect?
If i dont redirect then google will take away the pr4 next time round, i am confused now lol...
Just adding to that, if you *really* want to do it (and for the sake of Google bringing people here):
The reason your version fails is because of the ? question mark ? You cannot use the question mark in the match as it signals a querystrings which is caught as separate data.
This basic example will do what you want for the specific URL quoted, but it can probably be better refined or optimised.
With this, your rewrite code can grab the '/1, /2, /3' and use that data in the redirect response - so you would have one rule to deal with all cases, plus a safety trap that redirects any non-existent files/pages should some user request something like mysite.com/tutorials/9999999999.
But you are working back to front because you are trying to transcribe:
From a code perspective there is no structure for mod_rewrite to work with, and you have no choice but to use an individual rule for id=14 for it to redirect to: /blog-post/logo-in-5-minutes-photoshop-tutorial/1/. If you only have 8 links it is not the end of the world, just write 8 rules. It's not optimal, but it should work without obvious issue.
MOD_REWRITE is not always the answer. Sometimes it is better to have a scripted handler that grabs the querystring, looks it up in a local array, table or database, and redirects based upon that. In your case, where your links are already making use of a querystring it may be a better option to put a simple php redirector together.
As for page ranking et al, it is not an area I can honestly say I am confident to give good advice in. I think in terms of logic, mostly, but this may be flawed and not match the metric used by search engines.
Quote:
id=6 etc once, you have queried the blog once it does not allow you to do the same for others.
Once you arrive at the target page (by redirection or directly) your links on that page should be fixed to point directly to the correct place and need no redirection, surely?
Last edited by leslie.jones; 01-05-2012 at 01:34 PM..
With this, your rewrite code can grab the '/1, /2, /3' and use that data in the redirect response - so you would have one rule to deal with all cases, plus a safety trap that redirects any non-existent files/pages should some user request something like mysite.com/tutorials/9999999999.
But you are working back to front because you are trying to transcribe:
From a code perspective there is no structure for mod_rewrite to work with, and you have no choice but to use an individual rule for id=14 for it to redirect to: /blog-post/logo-in-5-minutes-photoshop-tutorial/1/. If you only have 8 links it is not the end of the world, just write 8 rules. It's not optimal, but it should work without obvious issue.
MOD_REWRITE is not always the answer. Sometimes it is better to have a scripted handler that grabs the querystring, looks it up in a local array, table or database, and redirects based upon that. In your case, where your links are already making use of a querystring it may be a better option to put a simple php redirector together.
As for page ranking et al, it is not an area I can honestly say I am confident to give good advice in. I think in terms of logic, mostly, but this may be flawed and not match the metric used by search engines.
Once you arrive at the target page (by redirection or directly) your links on that page should be fixed to point directly to the correct place and need no redirection, surely?
I had an old website that was really outdated.
There was no seo within the pages, the urls were all variables etc and not pretty.
So i completely re built the website.
Now the website has a different structure and completely different urls.
For instance my old contact page was say-hello.php
The new one is now, /contact-us/
The reason for the 301 is so that all old pages point to the same content which has now moved in url.
Ive spoken to people on seoforum.ord and seomoz.com and they have all stated that a 301 is a must if i want to keep page authority and rank for each and every page, plus all links from external websites still point to a relevent page.
That is why this is needed.
The query code which was given above made it so it added the id=14 on the end of the redirect which is causing a problem, which means the query can only be input once because on the next one it shows a page 404 instead.