This is a discussion on Is there a possiblity to do a redirect in .htaccess? within the Apache Web Server forums, part of the Web Server and Related Forums category; Hi, following problem: I'm administering a website for an organization that has the website hosted on the server of ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
following problem: I'm administering a website for an organization that has the website hosted on the server of a university that runs Apache on what I think is SunOS, so it should be a UNIX derivate. The link there so far has been something like http://www.something.tld/zyx/ Now the abbreviation for the organization changed, e.g. to "zyxw", so I had the university make another shortcut to http://www.something.tld/zyxw/ However, for reasons of backwards continuity (the old link has even been published in some real-world books) we want to keep the old link, but especially for Google purposes I'd like to have all the pages that are accessed under the old "zyx" be automatically redirected to "zyxw". Now, I have PHp access and can add somethign liek the following to each page, which fulfills that purpose: $callingpage = $PHP_SELF; if(substr($callingpage, 0, 4) == "/zyx"){ header("Location: http://www.something.tld/zyxw" .substr($callingpage, 4)); } However, that is highly unintelligent and would have to be doen for every new page I make, so I'd like to do it in a better way. Is there a way to do that with a central .htaccess file in the main directory (the one that has the starting page in)? Like, can I "tunnel" every page access through a specific PHP file that does that redirect if it's from "zyx"? Or something that can directly be done in the .htaccess file? I really have not much knowledge of Apache and/or Unix. Thanks in advance for any answers. -- ( ROT-13 if you want to email me directly: uvuc@ervzjrexre.qr ) "Sie tragen Trauer? Der Untergang der DDR?" - "Nein, Leni Riefenstahl. Der Führer hat sie zu sich genommen." -- Abschiedsshow Scheibenwischer, 02.10.2003 |
|
|||
|
"Ian.H" <ian@WINDOZEdigiserv.net> schrieb:
>> However, for reasons of backwards continuity (the old link has >> even been published in some real-world books) we want to keep the >> old link, but especially for Google purposes I'd like to have all >> the pages that are accessed under the old "zyx" be automatically >> redirected to "zyxw". > > RewriteRule ^/zyx(/.*)$ http://something.tld/zyxw$1 > [R=permanent,L] > > > This should then auto redirect [...] > > HTH =) Well, it didn't work exactly, but you gave me the right stuff to search for in Google, I'm using this now: Redirect permanent /zyx http://www.somethign.tld/zyxw So thanks a lot :-) -- ( ROT-13 if you want to email me directly: uvuc@ervzjrexre.qr ) "Sie tragen Trauer? Der Untergang der DDR?" - "Nein, Leni Riefenstahl. Der Führer hat sie zu sich genommen." -- Abschiedsshow Scheibenwischer, 02.10.2003 |