[SGVLUG] Apache Help-Rewrite Cond?

Rae Yip rae.yip at gmail.com
Thu Apr 19 10:01:42 PDT 2012


Are you familiar with regular expressions (regex)? That's the first
step to understanding rewrite rules.

Typically RewriteCond is just used as a regex match/non-match
condition for activating a rewrite rule.

-Rae.

On Wed, Apr 18, 2012 at 12:31 PM, Junaid A <junaidjan at yahoo.com> wrote:
>
> Yes, I used mod-rewrite with rewrite engine on. I redirected everything
> from abc.com/doc1 /doc 2 etc. to just xyz.com. However, that was not that I
> was supposed to do.
>
>
>
> There are other items on the server that need to be access via a web
> browser. This means that I can not redirect everything but only certain
> things.
>
>
>
> Someone told me I should look into the following:
>
>
>
> RewriteCond %{REQUEST_URI} ^https://abc.com/docs/([A-Z]\d{5,6})$  [NC]
>
> RewriteRule .* https://xyz.com/cgi-bin/private/DocDB/ShowDocument?docid=$1
> [L]
>
>
>
> However, I am not too familiar with RewriteCond and was looking for more
> guidance on that.
>
>
>
> Thanks again.
>
>
>
> Junaid
>
> From: sgvlug-bounces at sgvlug.net [mailto:sgvlug-bounces at sgvlug.net] On
> Behalf Of Bryan Backer
> Sent: Wednesday, April 18, 2012 12:26 PM
>
>
> To: SGVLUG Discussion List.
> Subject: Re: [SGVLUG] Apache Help-Rewrite Cond?
>
>
>
> You mention rewriting but how did you apply that?
>
>
> (what do your rules look like?)
> I assume the mod_rewrite rule you did just redirected all abc.com traffic
> to
> http://www.xyz.com/
>
> I assume that changing the DNS entries for the www.abc.com host
> to aim at www.xyz.com is not an option in that the www.abc.com
> server is still used for non port80 traffic?
>
> If so using mod_rewrite but with a more sophisticated
> URL rewrite so you leave the last part of the URI intact.
>
> I will look for references or examples that do what you're seeking
> (assuming I understand correctly). I'm starting at
> http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
>
> --- On Wed, 4/18/12, Junaid A <junaidjan at yahoo.com> wrote:
>
>
> From: Junaid A <junaidjan at yahoo.com>
> Subject: [SGVLUG] Apache Help-Rewrite Cond?
> To: "SGVLUG Discussion List." <sgvlug at sgvlug.net>
> Date: Wednesday, April 18, 2012, 11:35 AM
>
> Hi everyone,
>
>
>
> Is there an Apache Guru amongst us? I haven’t used Apache for a long time,
> especially on Unix. (Running Apache 2.0 on SunOS 5.10)
>
>
>
> I have to redirect specific documents on our old server to a new server. I
> already tried a mod rewrite and redirected everyone accessing the old server
> to go to the main page on the new server. However, that is not what I was
> supposed to do.
>
>
>
> I need help/guidance so that I may redirect www.abc.com/doc123 to server
> www.xyz.com/doc123 and so on.
>
>
>
> Is there someone who can help me by at least pointing me to a good
> forum/site that may guide me as to how I may accomplish this task?
>
>
>
> Thanks in advance.
>
>
>
> Junaid
>
> ________________________________
>
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2012.0.1913 / Virus Database: 2411/4944 - Release Date: 04/18/12


More information about the SGVLUG mailing list