更新时间:2023-01-08 09:34:51
如果你希望规则只在域为"tz433.tld"时执行,你需要这个条件:
RewriteCond %{HTTP_HOST} ^(www\.)?tz433\.tld
并将 "jobs/" 和 "jobs" 重定向到 "tz433.tld/about-us/jobs.html",您可以尝试以下方法之一:
RewriteRule ^jobs/?/about-us/jobs.html [R=301,L]# 或者重写规则 ^jobs/?http://tz433.tld/about-us/jobs.html [R=301,L]
I would like to have an alias and redirect the URL tz433.tld/jobs/
to the page tz433.tld/about-us/jobs/
.
This is what I've tried by far; it didn't work:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.tz433\.tld/jobs/$
RewriteRule (.*) http://tz433.tld/about-us/jobs.html [R=301,L]
The problem is, in this root path there are multiple domains, because it is a multisite typo3 installation. So something like "redirect /jobs
to /about-us/jobs
" isn't working because it should only happen for a specific domain (tz433).
The next specific thing is www.tz433.tld
automatically redirects to tz433.tld
. So it should also work with www.tz433.tld/jobs/
and tz433.tld/jobs
. Both should redirect to tz433.tld/about-us/jobs.html
.
How can I achieve that successfully?
If you want the rule to only execute when the domain is "tz433.tld", you need this condition:
RewriteCond %{HTTP_HOST} ^(www\.)?tz433\.tld
And to redirect "jobs/" and "jobs" to "tz433.tld/about-us/jobs.html", you can try one of these:
RewriteRule ^jobs/? /about-us/jobs.html [R=301,L]
# or
RewriteRule ^jobs/? http://tz433.tld/about-us/jobs.html [R=301,L]