Forum Moderators: phranque

Message Too Old, No Replies

Syntax in httacess: Permanent Redirection

Many redirections points to the same url? Syntax

         

silverbytes

9:04 pm on Apr 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is there any syntax to make the httacess shorter when you have too many permanent redirections? I have a lot and is hard to mantain and getting bigger (I'm worried about the filesize too)

Many of my redirections point to the same url:

Redirect permanent /index.htm [mynewsite.com...]

Redirect permanent /anotherpage.htm [mynewsite.com...]

is there someting like an OR operator (Redirect permanent /index.htm OR anotherpage.htm [mynewsite.com...]

jdMorgan

3:56 am on Apr 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



RedirectMatch accepts regular expressions, and therefore allows a local OR using the solid vertical pipe character.

You might also consider redirecting entire subdirectories rather than individual files... If that makes sense to do on your site.

Jim

silverbytes

10:01 pm on Apr 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What is RedirectMatch?

My problem is I moved domain and direct access to files that are not anymore causes 404 errors.

Many users access directly www.myoldsite.com/bla.htm

that bla.htm perhaps is not anymore on my newsite or it has an equivalent file.

I have a lots of redirects lines...
Can I just put
Redirect Permanent www.myoldsite.com/bla.htm OR www.myoldsite.com/bla2.htm www.mynewsite.com

?

Redirecting just / will catch any path?

In the other hand I have lots of gone files but that are indexed and well ranked by search engines so perhaps putting redirects of those to similar content files in my newsite be a way to mantain users on mysite...
If they get a 404 page they probably will go away....

drbrain

10:28 pm on Apr 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I recently rewrote my site, so I moved a bunch of top-level directories deeper in. My rewrite rules look something like:

Redirect permanant /FreeBSD http_//example.com/projects/FreeBSD

More specific links are above less specific links.

If a person goes to http_//example.com/FreeBSD/index.html, they'll be redirected to http_//example.com/projects/FreeBSD/index.html.

jdMorgan

12:01 am on Apr 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> What is RedirectMatch?

It's a variant of the Redirect directive. See [httpd.apache.org...]

> Can I just put Redirect Permanent www.myoldsite.com/bla.htm OR www.myoldsite.com/bla2.htm www.mynewsite.com?

No.

> Redirecting just / will catch any path?

Yes.

Jim