[Techtalk] Moving Websites: 301 Redirect

chris chris.madrone at gmail.com
Mon Jun 7 02:47:39 UTC 2010


really? you couldn't write a php function that would pull the #namedanchor out of the browser url request?

I know you can do that in ruby/rails and I think even javascript. It's been a little while since I mucked around with php

Also, re: just changing the links - I'm sure that's not the issue and easily done with a little scripting. The issue would be all inbound links to the named anchors of those urls.  It would be poor practice to rearchitect a website and not provide redirects from the old architecture to the new.

- chris



On Jun 6, 2010, at 12:21 PM, Sheila Fenelon wrote:

> chris wrote:
>> Hi Sue, the internal anchor link is navigated by the visitor's user
>> agent and will be ignored by mod_rewrite.  So, you'll likely need to
>> redirect at the application layer rather than the server layer.  I
>> would probably write a php function to detect the url + named anchor
>> then redirect it to appropriate page.
>> 
> 
> PHP will never see the named anchor because Apache doesn't see it. Also
> if you have access to the application why not just generate the new link
> and eliminate the named anchor completely?
> 
> You might be able to add some JavaScript to the page to redirect the
> anchor link to another page. But what's the point? If you have access to
> the application, and can add JS to the page, then just go ahead and
> change the link instead.
> 
> Sheila
> 
> 
>> 
>> On Jun 2, 2010, at 8:09 AM, Sue Stones wrote:
>> 
>>> A simple rewrite that works is
>>> 
>>> RewriteRule ^(.*)$ http://www.redcockatooaustralia.com/ [L,R=301]
>>> 
>>> But when I try to duplicate this approach with something like the
>>> following not much happens
>>> 
>>> RewriteRule ^(.*)/artists\.php\#artsec$
>>> http://www.redcockatooaustralia.com/artists/elly-chatfield/$
>>> [L,R=301]
>>> 
>>> 
>>> I tried writing some with "RewriteCond" clauses, but I am not
>>> certain of the flow of control without them, so it seemed better to
>>> leave that out, until I had something working that I wanted to put
>>> conditions on!  Similarly I have no idea what %{HTTP_HOST} means
>>> and consequently when I need it, leaving it out made no difference
>>> so far. Of course I have tried many variations on the lines above,
>>> but I am not much wiser!
>>> 
>>> Sue
>>> 
>>> 
>>> Sue Stones wrote:
>>>> I have rewritten a website and have moved it to a different
>>>> domain - well at least that is what I am trying to do.  It
>>>> sounded easy enough to set up a 301 redirect, but I haven't found
>>>> any tutorials that explain it simply in the depth that I need.
>>>> For SEO reasons I need to redirect each page to the most similar
>>>> page, and I can't work it out.  I can redirect the home page but
>>>> am not getting beyond that.
>>>> 
>>>> Here is one page that I want to move:
>>>> 
>>>> http://redcockatooaustralia.com.au/artists.php#artsec
>>>> 
>>>> To:
>>>> 
>>>> http://www.redcockatooaustralia.com/artists/elly-chatfield/
>>>> 
>>>> Any ideas how I would do this?
>>>> 
>>>> Sue
>>>> 
> 
> _______________________________________________
> Techtalk mailing list
> Techtalk at linuxchix.org
> http://mailman.linuxchix.org/mailman/listinfo/techtalk



More information about the Techtalk mailing list