1
0
mirror of https://github.com/cydrobolt/polr.git synced 2024-09-19 23:21:47 +02:00

Allow to set HTTP redirect code via new variable POLR_REDIRECT_CODE

This commit is contained in:
Peter Keel 2021-07-05 11:48:17 +02:00
parent 6e73538257
commit e1883fb4d2
3 changed files with 11 additions and 1 deletions

View File

@ -98,8 +98,13 @@ class LinkController extends Controller {
// Record advanced analytics if option is enabled // Record advanced analytics if option is enabled
ClickHelper::recordClick($link, $request); ClickHelper::recordClick($link, $request);
} }
if (env('POLR_REDIRECT_CODE')) {
$redirect_code = env('POLR_REDIRECT_CODE');
} else {
$redirect_code = 301;
}
// Redirect to final destination // Redirect to final destination
return redirect()->to($long_url, 301); return redirect()->to($long_url, $redirect_code);
} }
} }

View File

@ -73,6 +73,9 @@ SETTING_REDIRECT_404={{$ST_REDIRECT_404}}
# Set to true to enable password recovery # Set to true to enable password recovery
SETTING_PASSWORD_RECOV={{$ST_PASSWORD_RECOV}} SETTING_PASSWORD_RECOV={{$ST_PASSWORD_RECOV}}
# Set to change redirect code to e.g. 302 or 301
POLR_REDIRECT_CODE={{$POLR_REDIRECT_CODE}}
# Set to true to generate API keys for each user on registration # Set to true to generate API keys for each user on registration
SETTING_AUTO_API={{$ST_AUTO_API}} SETTING_AUTO_API={{$ST_AUTO_API}}

View File

@ -51,6 +51,8 @@ SETTING_SHORTEN_PERMISSION=false
SETTING_INDEX_REDIRECT= SETTING_INDEX_REDIRECT=
SETTING_PASSWORD_RECOV=false SETTING_PASSWORD_RECOV=false
POLR_REDIRECT_CODE=301
APP_LOCALE=en APP_LOCALE=en
APP_FALLBACK_LOCALE=en APP_FALLBACK_LOCALE=en