I want to redirect my old website to new website. I want to do this for main domain only, not sub pages.
For Example:
I have a website “example1.com”. I want to redirect “example1.com” to “example2.com”.
But if a visitor visits “example1.com/page”, he must not redirect. He should see the content on “example1.com/page”. Is this possible?
And 1 more thing. I get this error when someone visits a page that is not available. I want to redirect error page to home page.
Writing it just by heart (haven’t tested this), you should be able to redirect a specific URL using a .htaccess like like this:
RedirectMatch "^/$" "http://example2.com/"
The standard Redirect statement does prefix matching, whereas you can do exact matching with RedirectMatch, which allows for some other redirect options.