Home htaccess RewriteRule for new domain
Reply: 0

htaccess RewriteRule for new domain

user5022
1#
user5022 Published in September 19, 2018, 9:09 am

have some problems with my .htaccess file. I have two domains, old one and new one. i want to redirect user to the new site, when they visit the old domain.

Example: if they visit: "olddomain.com" then they should get redirected to "newdomain.com". this is actually not that hard to code BUT i want some special redirects too. if someone trys to visit "olddomain.com/service.html" then i want redirect the user to "newdomain.com/whatwedo.hml". And if someone trys to visit "olddomain.com/test/hello/text.html" then i want to redirect him to "newdomain.com/something/hello.html".

i have a list of 20 specific links i want to redirect.

what i've tried so far:

RewriteEngine On
RewriteCond %{HTTP_HOST} (www\.)?olddomain.com/service.html 
RewriteRule (.*) http://www.newdomain.com/whatwedo.hml [R=301,L]

RewriteCond %{HTTP_HOST} (www\.)?olddomain.com
RewriteRule (.*) http://www.newdomain.com/ [R=301,L]

with this code every visit on olddomain.com/whatever will redirect to "newdomain.com"

can someone help me?

thank you :)

Greetings

share|improve this question
  • Is your newdomain pointing to the same document root as your olddomain? – starkeen Apr 10 at 16:56

1 Answer 1

active oldest votes
up vote 0 down vote
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.407867 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO