History

Fix broken URLs

Thibaut Courouble committed 9 years ago

Commit 3b5eec71 parent 92584031 file · +34 −2Browse files

Unified · Split

lib/app.rb+34−2
@@ -281,6 +281,26 @@ class App < Sinatra::Application · 280 unmodified lines
281281 CODE
282282 end
283283
284+ %w(/maxcdn /maxcdn/).each do |path|
285+ class_eval <<-CODE, __FILE__, __LINE__ + 1
286+ get '#{path}' do
287+ 410
288+ end
289+ CODE
290+ end
291+
292+ {
293+ '/css-data-types/' => '/css-values-units/',
294+ '/css-at-rules/' => '/?q=css%20%40',
295+ '/html/article' => '/html/element/article'
296+ }.each do |path, url|
297+ class_eval <<-CODE, __FILE__, __LINE__ + 1
298+ get '#{path}' do
299+ redirect '#{url}', 301
300+ end
301+ CODE
302+ end
303+
284304 get %r{\A/feed(?:\.atom)?\z} do
285305 content_type 'application/atom+xml'
286306 settings.news_feed
@@ -288,6 +308,8 @@ class App < Sinatra::Application · 1 unmodified line
288308
289309 DOC_REDIRECTS = {
290310 'iojs' => 'node',
311+ 'node_lts' => 'node~6_lts',
312+ 'node~4.2_lts' => 'node~4_lts',
291313 'yii1' => 'yii~1.1',
292314 'python2' => 'python~2.7',
293315 'xpath' => 'xslt_xpath',
@@ -310,8 +332,18 @@ class App < Sinatra::Application · 16 unmodified lines
310332 return redirect "/angularjs/api#{rest}", 301
311333 end
312334
313− if rest && doc == 'dom' && rest.start_with?('/windowtimers')
314− return redirect "/dom#{rest.sub('windowtimers', 'windoworworkerglobalscope')}"
335+ if rest && doc == 'dom'
336+ if rest.start_with?('/windowtimers')
337+ return redirect "/dom#{rest.sub('windowtimers', 'windoworworkerglobalscope')}", 301
338+ end
339+
340+ if rest.start_with?('/window.')
341+ return redirect "/dom#{rest.sub('window.', 'window/')}", 301
342+ end
343+
344+ if rest.start_with?('/element.')
345+ return redirect "/dom#{rest.sub('element.', 'element/')}", 301
346+ end
315347 end
316348
317349 return 404 unless @doc = find_doc(doc)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t