Welcome to WebmasterWorld Guest from 54.145.144.101

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Howto rewrite google request old to new forum url ?

   
9:58 pm on Oct 31, 2008 (gmt 0)

10+ Year Member



Hello,

This is to difficult for me so i would appreciate some help..

Imagine having a lot of forum urls in google and then you decide to switch forum.
Big problem..

So my situation is as follows...

the old forum is is like this: website.com/image-vp0123456.html
So the image-vp0123456.html is the url

What lines could i use to redirect every google request (people coming from google search) to /forum ?

Any help please ?

10:19 pm on Oct 31, 2008 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



See Apache mod_alias or mod_rewrite. We can take specific questions, but this is a discussion forum, and we cannot write your code for you. There are not enough contributors here to offer that level of service. :(

Jim

10:30 pm on Oct 31, 2008 (gmt 0)

10+ Year Member



yes i understand....
but if i was capable of learning this i would do it.
some people never learn ,and its not my fault im one of them.
1:36 am on Nov 2, 2008 (gmt 0)

10+ Year Member



C'mon ...anybody ?
Is nobody willing to help out anymore ?
10:30 am on Nov 4, 2008 (gmt 0)

10+ Year Member



anyone ?
12:10 pm on Nov 4, 2008 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member




Options +FollowSymLinks
RewriteEngine on
#
RewriteCond %{HTTP_REFERER} google\.com
RewriteCond %{REQUEST_URI} !^/forum/
RewriteRule .* http://www.example.com/forum/ [R=301,L]

If the client provides a referrer (many times, they don't) then that should work. If the client does not provide a referrer, there is no solution.

See the references cited in our forum charter for more information.

Jim

[edited by: jdMorgan at 12:10 pm (utc) on Nov. 4, 2008]

12:54 pm on Nov 4, 2008 (gmt 0)

10+ Year Member



Thanks JD , but im missing something...

the old forum is is like this: website.com/image-vp0123456.html
So the image-vp0123456.html is the url

i dont see any code that rewrites all image-vp0123456.html etc..-> to /forum/

i mean...in google it has thousands of links like...

http://forum.example.com/image-vp0123456.html
there are thousands of different numbered html files,so the code to rewrite should recognize it as $1,2,3,4,5,6,k7,8,9,0 etc...

[edited by: jdMorgan at 3:32 pm (utc) on Nov. 4, 2008]
[edit reason] Please use example.com only. [/edit]

3:37 pm on Nov 4, 2008 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



You asked for every request referred from google to be redirected to the forum, which is what that code does. Please be extremely careful (and specific) about which URLs should be redirected, and which should not. It is impossible to code a solution until the actual requirements have been exactly-defined.

It is not likely that any code I post will be perfect for you, which is why you must attain the ability to understand and modify the code yourself. Otherwise, you will depend on others for the maintenance, well-being, and search rankings of your site. Unless you have a trusted part-time contractor on-call for this purpose, that is a really bad idea. It would be better to just let Google re-spider the site and put up with the 404s for awhile than to put code on your server that you don't understand.

Please read very, very carefully: Am I to understand that you wish to redirect only URLs of the form "http://forum.example.com/image-vp<seven-digit-number>.html", and that all of those those URLs are to be redirected to "http://www.example.com/forum/" or do you want something else?

Jim

4:14 pm on Nov 4, 2008 (gmt 0)

10+ Year Member



Indeed JD, thats the idea:

"redirect only URLs of the form "http://forum.example.com/image-vp<seven-digit-number>.html", and that all of those those URLs are to be redirected to "http://www.example.com/forum/"

as far as i can say is that it has 6 digits in its page creation.

4:45 pm on Nov 4, 2008 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member




Options +FollowSymLinks
RewriteEngine on
#
# If request referred from google.com domain (or any google subdomain)
RewriteCond %{HTTP_REFERER} ^https?://([^./]+\.)*google\.com
# and if our forum subdomain requested
RewriteCond %{HTTP_HOST} ^forum\.example\.com
# Externally redirect requests for /image-vp<six digits>.html to /forum/ index on main domain
RewriteRule ^image-vp[0-9]{6}\.html$ http://www.example.com/forum/ [R=301,L]

Note that this will only redirect requests to the forum subdomain which are referred from google and which include a Referer header.

It will not redirect Googlebot or user-type-ins of the old URLs, because these requests will not include an HTTP Referer header. If you wish the rule to be applied to these cases, then delete the first RewriteCond.

It will not redirect requests for any other subdomains, or for URL-paths which do not match the "image-vp<six digits>.html" pattern.

Be sure to completely-flush your browser cache before testing.

Jim

5:03 pm on Nov 4, 2008 (gmt 0)

10+ Year Member



Thank you very much for your time Jim.
I will give this a try.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month