SOLVED! Trying to redirect a url but strip its path data first. Stumped


#1

SOLVED, so no need to reply. :slight_smile: The solution was posted by RoseHosting on Reddit. Figured I’d share the solution. She/he advised me to add the following code to my .htaccess file (swapping out the domain names for my own, of course):

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?domaina\.com$ [NC]
RewriteRule ^(.*)$ "http://www.domainb.com/" [R=301,L]

My original post:
I currently have a domain forwarding to another, but I’m having trouble removing the path data. For example: domainA.com forwards to domainB.com. However, if someone visits domainA.com/other-page, they are forwarded to domainB.com/other-page where they get a 404 error (since there’s no other-page on domainB.com). I want to strip away all other url data before forwarding the visitor, so domainA.com/any/path/data/here forwards to domainB.com (without the extra bits). Is there some .htaccess voodoo that will make that happen?

I’m stumped (and an htaccess noob) and hoping someone here can help. Thanks for your help!