Nikolai Engel Nikolai Engel - 3 months ago 11x
PHP Question

Add current year in redirect htaccess

I try to write a Rewrite Rule which route from:



My .htaccess looks now like this:

RewriteEngine on
Redirect 301 /abteilungen/einsatzabteilung/einsaetze.php %{HTTP_HOST}/abteilungen/einsatzabteilung/einsaetze/

Is it possible that the year at the end of the target get the current year and how can i do this?


in apache exist variable TIME_YEAR

RewriteEngine on
Redirect 301 /abteilungen/einsatzabteilung/einsaetze.php %{HTTP_HOST}/abteilungen/einsatzabteilung/einsaetze/%{TIME_YEAR}

try use RewriteRule

RewriteEngine On
RewriteRule ^/abteilungen/einsatzabteilung/einsaetze.php$ %{HTTP_HOST}/abteilungen/einsatzabteilung/einsaetze/%{TIME_YEAR} [R=301,L]