Options -MultiViews
DirectoryIndex index.plp
+DirectorySlash Off
RewriteEngine on
RewriteBase /
RewriteRule ^(digraphs)\.ex(/.*)?$ $1.vim$2
# add .plp if a file exists with .plp appended (topdir only)
-RewriteCond %{REQUEST_FILENAME}.plp -f
+RewriteCond %{REQUEST_FILENAME} !-f
+RewriteCond %{DOCUMENT_ROOT}/$1.plp -f
RewriteRule ^/*([^/]+)(.*) $1.plp$2
# allow browsers to cache for upto a month
<(common.inc.plp)><:
-if ($Request and $Request =~ s{^edit/?}{}) {
- Include 'writer.plp';
- exit;
-}
-
-if ($Request and $Request =~ s{^quiz/?}{}) {
- Html({
- raw => <<'EOT',
-<script src="/wordquiz.js"></script>
-<style>
-.wrong {background: red}
-.good {background: green}
-</style>
-EOT
- });
- say '<h1>quiz</h1><p id="quiz">test</p>';
- exit;
+if ($Request and $Request =~ m{\A([^/]+)}) {
+ my $page = "word/$1.plp";
+ if (-e $page) {
+ Include $page;
+ exit;
+ }
}
my $lang = $get{lang} || 'en';
-<(common.inc.plp)><:
+<(../common.inc.plp)><:
+s{\Aedit(/|\z)}{} for $Request // ();
Html({
title => 'words cheat sheet admin',
version => '1.0',
nocache => 1,
raw => <<'EOT',
-<link rel="stylesheet" type="text/css" media="all" href="/editor.css" />
-<script src="/writer.js"></script>
+<link rel="stylesheet" type="text/css" media="all" href="/word/editor.css" />
+<script src="/word/editor.js"></script>
EOT
});
} or Abort('Database error', 501, $@);
my $user = eval {
- my $rootpath = ($ENV{REQUEST_URI} // '/writer') =~ s{(?<!^)/.+}{}r;
+ my $rootpath = '/word/edit';
if (defined $post{username}) {
$cookie{login} = EncodeURI(join ':', @post{qw( username pass )});
}
--- /dev/null
+<(../common.inc.plp)><:
+
+Html({
+ raw => <<'EOT',
+<script src="/word/quiz.js"></script>
+<style>
+.wrong {background: red}
+.good {background: green}
+</style>
+EOT
+});
+say '<h1>quiz</h1><p id="quiz">test</p>';