Home htaccess RewriteRule for new domain
Reply: 0

htaccess RewriteRule for new domain

user1133 Published in July 20, 2018, 2:20 pm

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 :)


You need to login account before you can post.

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

© 2016 Powered by mzan.com design MATCHINFO