mod rewrite for 404's -- moving directories on complex config

This is a discussion on mod rewrite for 404's -- moving directories on complex config within the Apache Web Server forums, part of the Web Server and Related Forums category; Hi, I have many directories from years ago on a fileserver. Many of them are indexed on Google. I have ...


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 04-27-2007
Davers
 
Posts: n/a
Default mod rewrite for 404's -- moving directories on complex config

Hi,

I have many directories from years ago on a fileserver. Many of them
are indexed on Google. I have five webservers reading from one
fileserver for the data. I'd like to keep copies of the most recent
data on the webservers and through mod_rewrite tell it to use local
copies instead of reading through the fileserver. I would like to move
most of my older directories into an "archived" directory.

If I move most of my older directories into an archived directory, the
Google listings will then 404. I could put a 404 doc up redirecting to
the index page, but Google will drop the link, which I would like to
avoid.

I could add a new RewriteCond / RewriteRule (below) for each new
directory. But, it would need to be added in the httpd.conf file for
each of the webservers and restarted. With the number of new
directories I add, this would be infeasible.

Does anyone know of a way to accomplish what I am trying to do? I do
not need the older directories in the "archived" directory to be
accessible or rewritten, I just don't want to lose the search engine
listings from them. And, I want to reduce the strain on the fileserver
for these files.

I also don't know of a way to say: rewrite everything locally unless
it is in the /dir1/archived directory and if there is a 404, the
directory probably existed at some point, redirect that to the index
and give a 200 status code.

Does anyone have any suggestions? I tried mod_cache but it doesn't
seem all that speedy.

Thanks,
Dave


RewriteEngine on
RewriteCond %{REQUEST_URI} ^/dir1/dir2
RewriteRule ^/dir1/dir2/(.*)$ /path/to/dir1-localcache/dir2/$1

  #2 (permalink)  
Old 04-28-2007
shimmyshack
 
Posts: n/a
Default Re: mod rewrite for 404's -- moving directories on complex config

On Apr 27, 3:35 pm, Davers <dszos...@gmail.com> wrote:
> Hi,
>
> I have many directories from years ago on a fileserver. Many of them
> are indexed on Google. I have five webservers reading from one
> fileserver for the data. I'd like to keep copies of the most recent
> data on the webservers and through mod_rewrite tell it to use local
> copies instead of reading through the fileserver. I would like to move
> most of my older directories into an "archived" directory.
>
> If I move most of my older directories into an archived directory, the
> Google listings will then 404. I could put a 404 doc up redirecting to
> the index page, but Google will drop the link, which I would like to
> avoid.
>
> I could add a new RewriteCond / RewriteRule (below) for each new
> directory. But, it would need to be added in the httpd.conf file for
> each of the webservers and restarted. With the number of new
> directories I add, this would be infeasible.
>
> Does anyone know of a way to accomplish what I am trying to do? I do
> not need the older directories in the "archived" directory to be
> accessible or rewritten, I just don't want to lose the search engine
> listings from them. And, I want to reduce the strain on the fileserver
> for these files.
>
> I also don't know of a way to say: rewrite everything locally unless
> it is in the /dir1/archived directory and if there is a 404, the
> directory probably existed at some point, redirect that to the index
> and give a 200 status code.
>
> Does anyone have any suggestions? I tried mod_cache but it doesn't
> seem all that speedy.
>
> Thanks,
> Dave
>
> RewriteEngine on
> RewriteCond %{REQUEST_URI} ^/dir1/dir2
> RewriteRule ^/dir1/dir2/(.*)$ /path/to/dir1-localcache/dir2/$1


you could try the !-f and !-d conditions to provoke the rewrite if and
only if the files arent present locally:
http://httpd.apache.org/docs/2.0/rew...ml#redirect404
or under "retrieve missing data from in tranet" a little durther on
within this section:
http://httpd.apache.org/docs/2.0/rew...d.html#content

they could both be adapted i think.

 
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 01:19 AM.


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