Apache Mod Rewrite Query

Hi,

Hoping someone can assist with a mod rewrite query. I seem to be
getting very confused with figuring this out.

Firstly, I need this to be "rewrite" and not "redirect."

I have a site, with a directory, with pages in the directory. The site
name stays the same, the page names stay the same, but the directory
name changes. There are numerous pages in the directory.

So, for example:

http://www.test.com/directory1/test-1.html

shoud become

http://www.test.com/directory2/test-1.html


I'm thinking this should be quite simple, but I don't seem to have
figured it out. Any assistance would be greatly appreciated.

Thanks!
JD
superman183 [ Mo, 31 Dezember 2007 14:11 ] [ ID #1896621 ]

Re: Apache Mod Rewrite Query

On Dec 31, 1:11=A0pm, superman183 <superman... [at] hotmail.com> wrote:
> Hi,
>
> Hoping someone can assist with a mod rewrite query. I seem to be
> getting very confused with figuring this out.
>
> Firstly, I need this to be "rewrite" and not "redirect."
>
> I have a site, with a directory, with pages in the directory. The site
> name stays the same, the page names stay the same, but the directory
> name changes. There are numerous pages in the directory.
>
> So, for example:
>
> http://www.test.com/directory1/test-1.html
>
> shoud become
>
> http://www.test.com/directory2/test-1.html
>
> I'm thinking this should be quite simple, but I don't seem to have
> figured it out. Any assistance would be greatly appreciated.
>
> Thanks!
> JD

RewriteEngine On
RewriteRule ^/directory([0-9])/(.*)$ /directory2/$2

that does what you asked for, but there are many ways to do it. If
there are only a few you could list them all and do
^/(old1||old2||old3)(.*)$ /directory/$2
shimmyshack [ Mo, 31 Dezember 2007 17:34 ] [ ID #1896623 ]

Re: Apache Mod Rewrite Query

> RewriteEngine On
> RewriteRule ^/directory([0-9])/(.*)$ /directory2/$2
>
> that does what you asked for, but there are many ways to do it. If
> there are only a few you could list them all and do
> ^/(old1||old2||old3)(.*)$ /directory/$2- Hide quoted text -
>

Many thanks - much appreciated; that works fine for me.

Best,
JD
superman183 [ Di, 01 Januar 2008 01:22 ] [ ID #1897214 ]
Webserver » alt.apache.configuration » Apache Mod Rewrite Query

Vorheriges Thema: [STAT] Statistics of alt.apache.configuration 01/01/08
Nächstes Thema: SSL'd Apache 2.2 Reverse Proxy to OWA 2007 Upload Problem