301 Redirects Question

 
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions
View previous topic :: View next topic  
Author Message
mg66
-


Joined: 15 Aug 2004
Posts: 85
Location: USA, Illinois

PostPosted: Wed Mar 23, 2005 11:28 pm    Post subject: 301 Redirects Question Reply with quote

Since I have 2 domains now and I split all my hunting stuff to the new domain www.bghi.us I have a small dilema.

Can I do a 301 redirect like is used in htaccess file within Abyss X2 so any already spidered urls that point to the old web site automatically redirect to the new urls?
_________________
mg66

http://sv650.metromain.net
http://photography.metromain.net
http://weather.metromain.net
http://www.metromain.net
http://www.bghi.us


Abyss Web Server X2
Back to top View user's profile Send private message Visit poster's website
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Thu Mar 24, 2005 12:38 am    Post subject: Re: 301 Redirects Question Reply with quote

mg66 wrote:
Since I have 2 domains now and I split all my hunting stuff to the new domain www.bghi.us I have a small dilema.

Can I do a 301 redirect like is used in htaccess file within Abyss X2 so any already spidered urls that point to the old web site automatically redirect to the new urls?

This feature is not yet available in the Abyss Web Server, it will be added soon. Meanwhile you can use a script to simulate it (but it depends). We recommend contacting us and giving us some sample URLs and we'll tell you how to do.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Thu Mar 24, 2005 4:28 pm    Post subject: Re: 301 Redirects Question Reply with quote

mg66,

Here is a simple script in PHP that can do what you ask for. Call it for example 404.php and configure it to be your custom 404 error page.

Code:

<?php

/* Add in this array the list of (old path => new path) pairs */
$redirection = array(
   "/old/myoldarticle.html" => "/myarticle.html",
   "/data/image.jpg" => "/pwrabyss.gif"
);

$uri = $_SERVER["REDIRECT_SCRIPT_NAME"];
$new_uri = $redirection[ $uri ];

if ($new_uri)
{
   header("Status: 301 Moved Permanently");
   header("Location: $new_uri");
   exit;
}

?>

<!-- Your 404 error page -->

<HTML>
<HEAD>
<TITLE>
Not Found
</TITLE>
</HEAD>
<BODY>
The object <tt><?php echo $uri; ?></tt> is not available.
</BODY>
</HTML>


All you have to is to customize the last part of the page and to fill the $redirection array with the old/new paths pairs.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
mg66
-


Joined: 15 Aug 2004
Posts: 85
Location: USA, Illinois

PostPosted: Fri Mar 25, 2005 8:49 pm    Post subject: Reply with quote

Thanks for the quick reply and code. Unfortunately I do not run php.
_________________
mg66

http://sv650.metromain.net
http://photography.metromain.net
http://weather.metromain.net
http://www.metromain.net
http://www.bghi.us


Abyss Web Server X2
Back to top View user's profile Send private message Visit poster's website
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Fri Mar 25, 2005 9:33 pm    Post subject: Reply with quote

But dude you should use PHP , this script rules , im now able to do URL Rewrites
on my web pages , I hate telling people that a file/dir changed , problem solved.


Last edited by TRUSTAbyss on Sat Mar 26, 2005 9:46 pm; edited 1 time in total
Back to top View user's profile Send private message Visit poster's website
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Fri Mar 25, 2005 10:54 pm    Post subject: Reply with quote

mg66 wrote:
Thanks for the quick reply and code. Unfortunately I do not run php.

What is the language you use? We can convert the script quickly.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
mg66
-


Joined: 15 Aug 2004
Posts: 85
Location: USA, Illinois

PostPosted: Sat Mar 26, 2005 12:31 pm    Post subject: Reply with quote

I use Perl. Version 5 I believe.
_________________
mg66

http://sv650.metromain.net
http://photography.metromain.net
http://weather.metromain.net
http://www.metromain.net
http://www.bghi.us


Abyss Web Server X2
Back to top View user's profile Send private message Visit poster's website
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Sat Mar 26, 2005 11:39 pm    Post subject: Reply with quote

mg66 wrote:
I use Perl. Version 5 I believe.

So we'll convert it to Perl and post it here :-)
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Mon Mar 28, 2005 6:03 pm    Post subject: Reply with quote

Here is the Perl version:

Code:


# Add in this array the list of (old path => new path) pairs
%redirection = (
   "/old/myoldarticle.html" => "/myarticle.html",
   "/data/image.jpg" => "/pwrabyss.gif"
);

$uri = $ENV{ "REDIRECT_SCRIPT_NAME" };
$new_uri = $redirection{ $uri };

if ($new_uri)
{
   print "Status: 301 Moved Permanently\n";
   print "Location: $new_uri\n\n";
   exit;
}

print <<EOM;

<!-- Your 404 error page -->

<HTML>
<HEAD>
<TITLE>
Not Found
</TITLE>
</HEAD>
<BODY>
The object <tt>$uri</tt> is not available.
</BODY>
</HTML>

EOM


_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
mg66
-


Joined: 15 Aug 2004
Posts: 85
Location: USA, Illinois

PostPosted: Tue Mar 29, 2005 6:09 am    Post subject: Reply with quote

Thankyou. Once again the assistance from the Abyss forum has proved that this web server is #1.
_________________
mg66

http://sv650.metromain.net
http://photography.metromain.net
http://weather.metromain.net
http://www.metromain.net
http://www.bghi.us


Abyss Web Server X2
Back to top View user's profile Send private message Visit poster's website
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Fri Apr 08, 2005 4:23 pm    Post subject: Reply with quote

I found an even better way , using an Aliases you can properly redirect the
visitor to the changed page. Their's always a limitation when it comes to a
script so if you decide to use this , only html/php files will work.

Purpose of this new version:

Properly redirects IE users that didn't disable their Show errors option
and so when a person requests a file on Internet Explorer , they will
get properly redirected because the old file name is the aliases.

Installing This new version:

01. Save the code in a file named redirect.php and put it in your
htdocs or anywhere you think would be a good place to put it at.

Code:

<?php
$redirection = array(
   "/old.html" => "/new.html",
   "/old2.html" => "/new2.html");

$uri = $_SERVER["REQUEST_URI"];
$new_uri = $redirection[$uri];

if ($new_uri)
{
   header("Status: 301 Moved Permanently");
   header("Location: $new_uri");
   exit;
}
?>


02. Edit the Array just like Aprelium explained above and seperate
each new URL Rewrite record with a comma. Open your console.

03. Add an Associated extension for PHP as htm and html then go to
the Aliases section and add an aliases for each old file that you want
to redirect people from , here's a short example on doing this.

File Aliases: Example

Virtual Path: /old.html
Real Path: htdocs/redirect.php

Note: If you are redirecting someone using a sub folder path and not
with a file name , you will have to add that path to the Script Paths.
Back to top View user's profile Send private message Visit poster's website
mg66
-


Joined: 15 Aug 2004
Posts: 85
Location: USA, Illinois

PostPosted: Fri Apr 08, 2005 10:43 pm    Post subject: Reply with quote

Cool. Thanks. Since installing PHP I see the increased possibilities with it installed.
_________________
mg66

http://sv650.metromain.net
http://photography.metromain.net
http://weather.metromain.net
http://www.metromain.net
http://www.bghi.us


Abyss Web Server X2
Back to top View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group