Today I’ll be super busy preparing the order of a true legend — @Joseinnewworld, who just swept around 58 #NFTs 😳🔥 That’s insane support… looks like I’ll be pulling an all-nighter to get everything ready 😅🙌 #NFT #NFTCollection #NFTCollectors #eCash $XEC #CryptoMevXBOT https://t.co/5iHxVEGjRo pic.twitter.com/xjpvlw34L6
— NFToa (@nftoa_) August 19, 2025
I'm not sure how to say this in a simple form to return appropriate search results, so I've created a Stack.
I have two domains.
Domain1.com
Domain2.com
I want all instances of Domain2.com to redirect to Domain1.com automatically.
If a slug path is provided for Domain2.com, I want that slug path to be carried over to be detected by Domain1.com .
Then, I want Domain1.com to detect anything coming from Domain2.com and redirect according to the matching slug path on Domain1.com .
Example:
Domain2.com/this-slug
automatically redirected to
Domain1.com/this-slug
...because Domain1.com understands exactly what to do with Domain2.com and any slugs forwarded with it.
I would prefer (I think) this to be done via .htaccess but I am open to other methods. In the next year I hope to move to NGINX so I am not sure how that will work which is why I am open to other methods being brought in at that time.
I think the difference from the search results I found is that I want this to be done automatically and not manually enter the slug path for each one that is needed. I am basically using Domain2.com as a Share URL to Domain1.com.
Solution
If you want to redirect domain2.com/this-slug to domain1.com/this-slug , add this rewrite rule to domain2.com's htaccess file:
RewriteEngine On
# First condition, requested resource is not an existing file in domain2.com (this condition can be removed if needed)
RewriteCond %{REQUEST_FILENAME} !-f
# Second condition, requested resource is not an existing directory file in domain2.com (this condition can be removed if needed)
RewriteCond %{REQUEST_FILENAME} !-d
# Third condition, slug must exist
RewriteCond %{REQUEST_URI} !^/?$
# Do the redirection
RewriteRule ^(.*)$ http://domain1.com/$1 [R=301,QSA,L]Please note that with this rewrite rule domain2.com/something/this-slug will redirect to domain1.com/something/this-slug , if you don't want to redirect if there are trailing slashes in the request URI, use this as the third condition instead:
RewriteCond %{REQUEST_URI} ^/?[^/]+$
