Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3774785
D3427.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D3427.diff
View Options
diff --git a/redirect/_documents.xml b/redirect/_documents.xml
new file mode 100644
--- /dev/null
+++ b/redirect/_documents.xml
@@ -0,0 +1,14 @@
+<!--
+ The following files are independant entry points able to be called directly, without index.php.
+
+ You can configure your web server to bypass Pluton for these. If you don't, Pluton will know not to print header/footer.
+-->
+<documents topic="redirect">
+ <document>
+ <article>index</article>
+ <title>Redirect</title>
+ <description>Redirect to the specified resource.</description>
+ <noheader />
+ <nofooter />
+ </document>
+</documents>
diff --git a/redirect/_targets.php b/redirect/_targets.php
new file mode 100644
--- /dev/null
+++ b/redirect/_targets.php
@@ -0,0 +1,6 @@
+<?php
+
+return [
+ "perdu" => "https://www.perdu.com/",
+ "visit-brussels" => "https://www.ticketing.brussels/fr/tickets?lastMinuteTickets=true&from=%%YYYY%%-%%MM%%-%%DD%%&to=%%YYYY%%-%%MM%%-%%DD%%",
+];
diff --git a/redirect/index.php b/redirect/index.php
new file mode 100644
--- /dev/null
+++ b/redirect/index.php
@@ -0,0 +1,27 @@
+<?php
+
+function resolve_url (string $url) : string {
+ $search = [
+ "%%YYYY%%",
+ "%%MM%%",
+ "%%DD%%",
+ ];
+ $replace = [
+ date('Y'),
+ date('m'),
+ date('d'),
+ ];
+
+ return str_replace($search, $replace, $url);
+}
+
+$target = $_REQUEST["target"] ?? $_REQUEST["t"] ?? "";
+$targets = require('_targets.php');
+
+if ($target !== "" && array_key_exists($target, $targets)) {
+ $target_url = resolve_url($targets[$target]);
+ header('Location: '. $target_url);
+ exit;
+}
+
+header("HTTP/1.0 404 Not Found");
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 25, 13:43 (13 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2262631
Default Alt Text
D3427.diff (1 KB)
Attached To
Mode
D3427: Provide a tiny redirect service
Attached
Detach File
Event Timeline
Log In to Comment