httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Igor Cicimov <>
Subject Re: [users@httpd] please help with mod_rewrite rules
Date Sun, 30 May 2010 01:04:28 GMT
Use the proxy flag P in the redirect to preserve the url but have in mind
that it will work for the first page only. When you click on any link on it
the url will be changed to the new one then.

Sent from my phone

On May 30, 2010 5:20 AM, "Mari Masuda" <> wrote:


I am moving a large website from a proprietary CMS to Drupal.  In the
proprietary CMS, all media files (images, pdfs, etc.) have URLs like or  In my Drupal .htaccess I have
created the following two mod_rewrite rules so that the old URLs will
continue to work and so we can continue using the scheme of instead of using the Drupal

 # handle imagecache images
 RewriteCond %{HTTP_HOST} ^media\.(xxx|xxx-stage)\.org$
 RewriteCond %{QUERY_STRING}
 RewriteRule ^/?(.*) /imagecache/%1/$1? [L,NE]

 # handle requests for things at
 RewriteCond %{HTTP_HOST} ^media\.(xxx|xxx-stage)\.org$
 RewriteRule ^/?(.*)$1 [L]

I am not that experienced in regular expressions or mod_rewrite so I am
actually not completely sure how I got the above rewrite rules to work, but
they do actually work.  (Beginner's luck, I guess!)  In the actual
RewriteRule of the second block (i.e., RewriteRule ^/?(.*) http://media.%$1 [L]) I had to put the in
order to get it to work.  My question is how can I mask the rewritten URL so
in the browser's address bar it just shows instead of  To complicate
matters, I believe our host uses a link of some sort so that is actually a link to
/some/other/path/on/the/server.  When I was looking at the Apache
documentation it seemed like Alias or AliasMatch would be the thing to use
to mask the URL but I could not figure out how to get it to work.

Thank you for any tips!

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
  "   from the digest:
For additional commands, e-mail:

View raw message