问题
I am setting up a Shopify site using a custom domain. However, I have old links on that domain that I don't want to break once I point it to Shopify. I also have old parked domains on top of this domain that I don't want to break.
Shopify instructs you to set up an A record for the domain (so when I go to www.mydomain.com I see my Shopify store). But I want to set up exceptions such that www.mydomain.com/my-seo-link won't show Shopify, or will allow me to forward to its replacement at Shopify.
An added complication is I also have parked domains on top of my domain that I want to remain pointing to my old server.
Is there such thing as a URI exception to an A record?
回答1:
Put this code in your DOCUMENT_ROOT/.htaccess
file of www.mydomain.com
:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.mydomain\.com$ [NC]
RewriteRule ^my-seo-link http://otherdomain.com%{REQUEST_URI} [NC,R=301,L]
回答2:
Go through your list of special URL's and use the Shopify built-in redirect mechanism to point all your old content at the new location for it on your Shopify store's domain. The DNS system is old, well understood and you need to use it in this case as you cannot have a Shopify store on a domain AND host that same domain on another server under your control. Use redirects. That is what they are they for.
来源:https://stackoverflow.com/questions/24540168/creating-an-exception-when-pointing-a-domain-using-a-record-shopify