redirect a specific url to another url with .htaccess

前端 未结 2 638
庸人自扰
庸人自扰 2021-02-13 05:24

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 di

相关标签:
2条回答
  • 2021-02-13 05:59

    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]
    
    0 讨论(0)
  • 2021-02-13 06:01

    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
    
    0 讨论(0)
提交回复
热议问题