Re: Redirect script

From: Date: Fri, 10 Nov 2000 11:22:35 +0000
Subject: Re: Redirect script
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-24647@lists.php.net to get a copy of this message
Dan Harrington wrote: > > Alrighty....here's a mess to consider. > > I have PHP 4 on Apache on Linux and this is what I want to do. > > The directories on the website are huge...massive path names. We want > people to be able > to type an address in that will bring them to the end of the tree without > having > to type the whole thing in. 1. Is mod_rewrite installed on the server? 2. Are you permitted to use .htaccess files in your web directories? If you answer yes to both, then you can configure the redirects through mod_rewrite. Redirect them all to the same file, and in that file use header( "Location: new_url" ); to redirect the browser to the correct page on the site. (Or just use plain mod_rewrite re-directs). > So here is my question. . . > I make a symbolic link for each of the lines found in redirect.txt to my > script. > > ln -s myscript.php link1 > ln -s myscript.php link2 > ln -s myscript.php link3 > ln -s myscript.php link4 ...etc. > > When the php script is called, it isn't executed, the source code is > displayed on the browser screen. > > If I call the php script directly, with the php extension > (www.hostname.org/myscript.php) > it runs fine and works. > > what to do? That depends. What are the suffixes of the links? If they end in .html, then it won't be parsed as php. You then need to use XBitHack On and set all the linked files as executable. If the files have other suffixes you have a bigger problem, you then need to add a handler for the suffixes in your .htaccess file like this: AddHandler application/x-httpd-php3 .html Hope this helps. -- Paul K Egell-Johnsen Developer/PR Manager eZ systems as http://zez.org/ - about: code

« previous php.general (#24647) next »