Forum Moderators: phranque
Is there some kind of official redirect code that can be used for just a few files within a site (like redirect 301)?
e.g. for a whole site I use:
redirect 301 / [domain.com...]
Does anyone think a 10 second refresh on those pages is a better solution?
you can't do a redirect for a whole site. your example from above indeed does for your main page only (even not for /index.html, just the domain-page).
the syntax for a redirect depends on what you use. in plain text http protocol, this would be:
- pass 301 as status code
- add a header called 'Location:' with the new permanent uri.
if you use a script language, for example php, this would be:
header('Location: [i]new permanent uri[/i]'); you can use severall other ways, like mod_rewrite in .htaccess files for example using rewrite_rule with the [R] flag.
...permanent: Returns a permanent redirect status (301) indicating that the resource has moved permanently.
Example: Redirect permanent /one [example.com...]
But I still can't see how I say
[example.com...] is now at [new.com...]
[example.com...] is now at [new.com...]
when the remaining pages stay the same. I need some syntax that lets me say old address = new address (for a selection of files - if you see what I mean.
This is feeling a bit complicated, perhaps I'll just go for the 10 second refresh.
Note: "Redirect" and "RedirectMatch" are different mod_alias directives with differing capabilities. The link I posted above is to RedirectMatch. Your subsequent example still refers to Redirect.
Also, a 10 second refresh returns a 200 status code to visitors so SEs/spiders have no reason to update your listings.