www.digitalmars.com         C & C++   DMDScript  

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

reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
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?


Thanks,

Andrei
Nov 12 2011
next sibling parent reply Adam D. Ruppe <destructionator gmail.com> writes:
Apache rewriting is the hardest thing in the world.


But I'd try putting a [R] at the end of that redirect line
and if it fails, check the error log.

tail /var/log/httpd/error_log

or whatever it is on your box. Sometimes there's something helpful
in there.
Nov 12 2011
parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 11/12/11 9:37 PM, Adam D. Ruppe wrote:
 Apache rewriting is the hardest thing in the world.


 But I'd try putting a [R] at the end of that redirect line
 and if it fails, check the error log.

 tail /var/log/httpd/error_log

 or whatever it is on your box. Sometimes there's something helpful
 in there.
The [R] applies to RewriteRule, not RedirectMatch. Walter, could you please take a look at the error log. Thanks! Andrei
Nov 12 2011
parent Walter Bright <newshound2 digitalmars.com> writes:
On 11/12/2011 7:45 PM, Andrei Alexandrescu wrote:
 On 11/12/11 9:37 PM, Adam D. Ruppe wrote:
 tail /var/log/httpd/error_log

 or whatever it is on your box. Sometimes there's something helpful
 in there.
The [R] applies to RewriteRule, not RedirectMatch. Walter, could you please take a look at the error log. Thanks!
tail: /var/log/httpd/error_log: No such file or directory
Nov 12 2011
prev sibling next sibling parent Michel Fortin <michel.fortin michelf.com> writes:
On 2011-11-13 03:28:33 +0000, Andrei Alexandrescu 
<SeeWebsiteForEmail 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 michelf.com http://michelf.com/
Nov 12 2011
prev sibling parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
Turns out all .htaccess use was disabled by the admin (Jan Knepper). He 
added the redirect straight to the config file of the server.

Now everything with the prefix http://digitalmars.com/d/2.0/ or 
http://www.digitalmars.com/d/2.0/ should redirect to the respective page 
on d-programming-language.org.

Let us know how that works!


Thanks,

Andrei
Nov 13 2011
parent Jude Young <10equals2 gmail.com> writes:
On Sun 13 Nov 2011 06:43:31 PM CST, Andrei Alexandrescu wrote:
 Turns out all .htaccess use was disabled by the admin (Jan Knepper).
 He added the redirect straight to the config file of the server.

 Now everything with the prefix http://digitalmars.com/d/2.0/ or
 http://www.digitalmars.com/d/2.0/ should redirect to the respective
 page on d-programming-language.org.

 Let us know how that works!


 Thanks,

 Andrei
It seems to be working quite nicely. My old bookmarks now redirect to exactly what they should. Thank you.
Nov 13 2011