Apache Mod Rewrite Query

Apache Mod Rewrite Query

am 31.12.2007 14:11:32 von superman183

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

Re: Apache Mod Rewrite Query

am 31.12.2007 17:34:22 von shimmyshack

On Dec 31, 1:11=A0pm, superman183 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

Re: Apache Mod Rewrite Query

am 01.01.2008 01:22:19 von superman183

> 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