redirects for chora
parent
27443066a4
commit
37bd5cbb83
|
@ -12,4 +12,16 @@ class Node < Application
|
||||||
headers['Location'] = purl
|
headers['Location'] = purl
|
||||||
return "<html><body>You are being <a href=\"#{purl}\">redirected</a>.</body></html>"
|
return "<html><body>You are being <a href=\"#{purl}\">redirected</a>.</body></html>"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def chora
|
||||||
|
if params[:program] and params[:program] =~ /PenguinCoder|tuxwiki/i
|
||||||
|
raise NotFound
|
||||||
|
end
|
||||||
|
safe_program = params[:program].gsub(/\W/, '').downcase
|
||||||
|
gurl = "http://github.com/penguincoder/#{safe_program}"
|
||||||
|
Merb.logger.info("Permenant Chora redirect for #{safe_program}")
|
||||||
|
self.status = 301
|
||||||
|
headers['Location'] = gurl
|
||||||
|
return "<html><body>You are being <a href=\"#{gurl}\">redirected</a>.</body></html>"
|
||||||
|
end
|
||||||
end
|
end
|
|
@ -1,9 +1,13 @@
|
||||||
Merb.logger.info("Compiling routes...")
|
Merb.logger.info("Compiling routes...")
|
||||||
Merb::Router.prepare do |r|
|
Merb::Router.prepare do |r|
|
||||||
r.match('/node/:id').to(
|
r.match('/node/(node/)?:id').to(
|
||||||
:controller => 'node',
|
:controller => 'node',
|
||||||
:action => 'show'
|
:action => 'show'
|
||||||
)
|
)
|
||||||
|
r.match('/horde/chora/:phpaction.php/:program').to(
|
||||||
|
:controller => 'node',
|
||||||
|
:action => 'chora'
|
||||||
|
)
|
||||||
r.resources :pages
|
r.resources :pages
|
||||||
r.resources :comments
|
r.resources :comments
|
||||||
r.resources :tags
|
r.resources :tags
|
||||||
|
|
Reference in New Issue