[Techtalk] Moving Websites: 301 Redirect

Sheila Fenelon sheila at shefen.com
Sun Jun 6 19:21:32 UTC 2010


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
>>> 



More information about the Techtalk mailing list