What I would like to do is use htaccess to redirect (301, Permanent Redirect) simple host only urls to another domain but only when the url contains no path or parameters.
For example:
http://www.mydomain.com should redirect to http://www.myotherdomain.com and
http://mydomain.com should redirect to http://myotherdomain.com
(which I have found plenty of examples for)
but a url like:
http://www.mydomain.com/someimage.jpg or http://mydomain.com/js/coolJsScript.js should not be redirected at all.
Any help would be greatly appreciated!
Thanks!
I think this rule will match incoming URLs without any path:
You haven’t stated exactly what you are trying to do here, but there might be an alternative, which is to check to see if a file exists, and redirect to your other site if it doesn’t exist. This test would be something like