Have you tried
Redirect 301 /bananas/ http://www.minibananasite.co.uk/
think that should work?
Jason
I have recently registered a shed load of domains and walloped together "mini sites", using info that was previously part of our main directory site - i.e. instead of http://www.mainsite.co.uk/bananas there is now http://www.minibananasite.co.uk (with the previous directory "bananas" now pointing at the new site).
All of this is fine and dandy, however under the old site I had a set up like:
http://www.mainsite.co.uk/bananas/details.php?q=bananaretailer1 - this would then give a lovely optimised page that details all about "bananaretailer1" - what I would like to do is automatically redirect this to the new site, but I really haven't got a Scooby, to utilise the language of my 4-year old...
I understand that a 301 within a .htaccess goes something like:
Redirect 301 /page.php http://www.newsite.co.uk/newpage.php
However I would like to make:
http://www.mainsite.co.uk/bananas/details.php?q="WHATEVER"
resolve to
http://www.minibananasite.co.uk/details.php?q="WHATEVER"
where the bit after q= is a variable, as opposed to a constant string..
Please can someone put me out of my misery?
Cheers![]()
Have you tried
Redirect 301 /bananas/ http://www.minibananasite.co.uk/
think that should work?
Jason
Thanks Jason - that is what we are doing for the "main" directories - the problem was with redirecting variables as opposed to a static constant - e.g. if someone clicks on a link to
http://www.oldsite.com/olddirectory/search.php?q=WHATEVER&order=WHATEVER
they are automatically redirected to:
http://www.newsite.com/newsearch.php?q=WHATEVER&order=WHATEVER
If it helps, there are only a couple of these types of files, they are all php, so I suppose I could edit the existing PHP file - which would lead to a further question - "How would one go about making dynamic php redirects" -
e.g.
1) Create a file called "details.php", which takes the bit after q=
<?
$details=$q;
echo $site[$details]."";
?>
2) Call the output of details.php within the header of
<?
include ("details.php");
Header ("Location: http://www.site2.co.uk/search.php?q=$details"); ?>
The problems with this are threefold:
1. The Header function cannot be used, as a header has already been called
2. "fopen" would expect more than 1 variable, and
3. I haven't really got the foggiest about what I am doing
If there is a simple "write this page" function that can be used instead of Header , above I would probably be on my way...
Apologies for the rambling once again...
edit search.php to contain
<?
$url = "http://www.newsite.com/newsearch.php?q=$q&order=$order";
header ("Location: $url"); ?>
that should work
Dan Morley
alpharooms.com
daniel at alpharooms dot com - Hotels, Flights, Airport Transfers, Care Hire + More! sign up
My Blog | Cheap Holidays
That is spot-on, thanks hugely!
The best bit is that I can see why it works too - thanks again..
no problemo![]()
Dan Morley
alpharooms.com
daniel at alpharooms dot com - Hotels, Flights, Airport Transfers, Care Hire + More! sign up
My Blog | Cheap Holidays
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks