Reputation: 1511
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?
Upvotes: 21
Views: 68605
Reputation: 3182
If someone is just interested in simple redirect you can try this:
Redirect /URL URLtoRedirect
e.g
Redirect /old-url https://mywebsite.com/new-url
Upvotes: 19
Reputation: 4469
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]
Upvotes: 25