Is there a possiblity to do a redirect in .htaccess?

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


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-09-2004
Holger Pollmann
 
Posts: n/a
Default Is there a possiblity to do a redirect in .htaccess?

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
  #2 (permalink)  
Old 02-09-2004
Holger Pollmann
 
Posts: n/a
Default Re: Is there a possiblity to do a redirect in .htaccess?

"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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:37 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0