Apache redirect digitalmars.com/d/2.0 -> d-programming-language.org

Michel Fortin michel.fortin at michelf.com
Sat Nov 12 20:28:22 PST 2011


On 2011-11-13 03:28:33 +0000, Andrei Alexandrescu 
<SeeWebsiteForEmail at erdani.org> said:

> Hello,
> 
> 
> I wrote this to the site admin (Jan Knepper) too. Walter and I are 
> trying to set up the digitalmars.com server such that all request for 
> pages under digitalmars.com/d/2.0/ go to the corresponding file in 
> d-programming-language.org/.
> 
> I experimented on my own website and here is the appropriate .htaccess 
> rule that works:
> 
> RedirectMatch ^/d/2\.0/(.*) http://d-programming-language.org/$1
> 
> With this, e.g.
> 
> http://digitalmars.com/d/2.0/phobos/std_algorithm.html
> 
> should automatically redirect to
> 
> http://d-programming-language.org/phobos/std_algorithm.html
> 
> When Walter put that .htaccess under the directory serving /d/2.0, we 
> got an internal server error.
> 
> Do you know what the issue might be? Is there some mistake we're making?

I don't know what is the issue with RedirectMatch, but usually I use 
Apache's rewrite engine for redirects. That'd be:

	RewriteEngine On

	RewriteRule ^d/2\.0/(.*)$ http://d-programming-language.org/$1 [R=301,L]

R=301 gives you a permanent redirect (HTTP response 301), L makes sure 
no other rewrite rule are applied.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/



More information about the Digitalmars-d mailing list