From a7a6c8c1d0830a0838c735b136a9ba867c6de4f8 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Fri, 8 Mar 2013 15:44:26 +0000 Subject: fix 404 --- index.cgi | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'index.cgi') diff --git a/index.cgi b/index.cgi index 6241434..e9e2c55 100755 --- a/index.cgi +++ b/index.cgi @@ -70,7 +70,7 @@ my $path = $cgi->path_info(); my $output = \&output_article; my @args; -if ( $path =~ /^\/(\d{4})\/(\d{2})\/([^\/]+)$/ ) { +if ( $path =~ m/^\/(\d{4})\/(\d{2})\/([^\/]+)$/ ) { @args = ( year => $1, month => $2, uri => $3 ); } elsif ( $path =~ m/^\/(\d{4})\/(\d{2})\/?$/ ) { @args = ( year => $1, month => $2 ); @@ -84,6 +84,8 @@ if ( $path =~ /^\/(\d{4})\/(\d{2})\/([^\/]+)$/ ) { $output = \&output_rss; } elsif ( $path =~ m/^\/sitemap\.xml$/ ) { $output = \&output_sitemap; +} elsif ( $path ) { + @args = ( error => 1 ); } $cgi->charset('UTF-8'); @@ -113,7 +115,8 @@ sub output_article { $template->param( copyright => $blog_rights ); $template->param( google_analytics_id => $google_analytics_id ); $template->param( google_webmaster_id => $google_webmaster_id ); - if (@{$articles}) { + + if (@{$articles} && !$args{'error'}) { $template->param( articles => $articles ); if ($comments_allowed && $args{'uri'}) { $template->param( comment_form => 1 ); -- cgit v1.2.3