Lewis M Hackfath
Lewis M Hackfath

Reputation: 131

301 redirect with multiple URL's using .htaccess

I have built a brand new website to replace an old website for a business

how do i use a .htaccess file to redirect the urls

eg.

www.business.com.au -> www.newbusiness.com.au www.business.com.au/about.htm -> www.newbusiness.com.au/about-us

so on and so forth for all the pages so that the old links point to the new links and the home page on the old site points to the home page of the new site.

thanks in advance for any help.

Upvotes: 0

Views: 5543

Answers (2)

PhilMasteG
PhilMasteG

Reputation: 3195

Since the paths on the old homepage are different from the paths on the new one, I suppose you would use a hand full of Redirect-Directives:

RewriteEngine on
RewriteRule ^$ http://newbusiness.com.au/ [R=301,L]

Redirect 301 /about.htm http://www.newbusiness.com.au/about-us
Redirect 301 /contact.htm http://www.newbusiness.com.au/new-contact

and so on.

Upvotes: 1

Petr Duchek
Petr Duchek

Reputation: 1233

  RewriteEngine On
  RewriteCond %{HTTP_HOST} ^www.business.com.au$
  RewriteRule (.*)$ http://www.newbusiness.com.au/$1 [R=301,L]

Upvotes: 1

Related Questions