问题
I´m trying to do a 301 redirect in a htacess file. I want to point all pages on one domain to one single page on another domain and I do not want to manually redirect all single pages.
Ex: www.olddomain.com/1.html and www.olddomain.com/2.html should both point to www.newdomain.com.
Hope anyone could help me.
回答1:
RewriteCond %{HTTP_HOST} .*olddomain\.com$
RewriteRule ^ http://www.newdomain.com/one-single-page.html [L,R=301]
回答2:
I had the same problem but this works fine for me to accomplish what you want, i actually need to opposite, for each page from old domain to redirect to new domain but keep inner structure so ill keep looking i guess!
redirectMatch 301 ^/ http://www.newdomain.com
来源:https://stackoverflow.com/questions/3959477/how-to-301-redirect-all-pages-from-one-domain-to-one-single-page-on-a-different