|
25 | 25 |
|
26 | 26 | TimeOut 300 |
27 | 27 |
|
28 | | - # Alias /robots.txt "/var/www/git.ruby-lang.org/robots.txt" |
29 | 28 | DocumentRoot /var/www/git.ruby-lang.org |
30 | 29 |
|
31 | 30 | RewriteEngine On |
32 | | - RewriteCond %{QUERY_STRING} (?:^|&)id=([0-9a-fA-F]{40}) |
| 31 | + |
| 32 | + # Serve robots.txt as a static file. cgit's "ScriptAlias /" would |
| 33 | + # otherwise route it to cgit.cgi (returning 404), so crawlers never |
| 34 | + # see the Disallow rule. mod_rewrite runs before mod_alias, so this |
| 35 | + # bypasses the ScriptAlias. |
| 36 | + RewriteRule ^/robots\.txt$ /var/www/git.ruby-lang.org/robots.txt [L] |
| 37 | + |
| 38 | + RewriteCond %{QUERY_STRING} (?:^|&)id=([0-9a-fA-F]{7,40}) |
33 | 39 | RewriteRule ^/ruby\.git/(?:log|commit|diff|patch)(?:/.*)?$ https://github.com/ruby/ruby/commit/%1 [R=302,L,NE,QSD] |
34 | | - RewriteCond %{QUERY_STRING} (?:^|&)id=([0-9a-fA-F]{40}) |
| 40 | + RewriteCond %{QUERY_STRING} (?:^|&)id=([0-9a-fA-F]{7,40}) |
35 | 41 | RewriteRule ^/ruby\.git/tree/(.*)$ https://github.com/ruby/ruby/tree/%1/$1 [R=302,L,NE,QSD] |
36 | | - RewriteCond %{QUERY_STRING} (?:^|&)id=([0-9a-fA-F]{40}) |
| 42 | + RewriteCond %{QUERY_STRING} (?:^|&)id=([0-9a-fA-F]{7,40}) |
37 | 43 | RewriteRule ^/ruby\.git/plain/(.*)$ https://github.com/ruby/ruby/raw/%1/$1 [R=302,L,NE,QSD] |
38 | 44 | RewriteRule ^/ruby\.git/plain/(.*)$ https://github.com/ruby/ruby/raw/master/$1 [R=302,L,NE,QSD] |
39 | 45 | </VirtualHost> |
0 commit comments