问题描述
我想要一个别名,并将URL tz433.tld / jobs /
重定向到页面 tz433.tld / about-us / jobs /
。
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]
问题是,在此根路径中有多个域,因为它是一个多站点typo3安装。因此,诸如将 / jobs
重定向到 / about-us / jobs
之类的东西不起作用,因为它只会发生
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).
下一个特定的内容是 www.tz433.tld
自动重定向到 tz433.tld
。因此,它也应与 www.tz433.tld / jobs /
和 tz433.tld / jobs
一起使用。两者都应重定向到 tz433.tld / about-us / jobs.html
。
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
.
如何成功实现?
推荐答案
如果您希望仅在域为 tz433.tld 时执行规则,则需要以下条件:
If you want the rule to only execute when the domain is "tz433.tld", you need this condition:
RewriteCond %{HTTP_HOST} ^(www\.)?tz433\.tld
并重定向 jobs / 和 jobs 到 tz433.tld / about-us / jobs.html ,您可以尝试以下方法之一:
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]
这篇关于使用.htaccess将特定的URL重定向到另一个URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!