Solved

htaccess to redirect a number of pages from one domain to another - wildcards?

Posted on 2014-01-08
4
228 Views
Last Modified: 2014-01-27
Hello

I have a number of pages that start with the same words in the file name that I want to redirect to another domain.

Example:

http://www.olddomain.com/fruits-that-taste-good
http://www.olddomain.com/fruits-that-taste-bad
http://www.olddomain.com/fruits-that-taste-sweet
http://www.olddomain.com/fruits-that-taste-sour

I want to do a 301 redirect to the following
http://www.newdomain.com/fruits-that-taste-good
http://www.newomain.com/fruits-that-taste-bad
http://www.newdomain.com/fruits-that-taste-sweet
http://www.newdomain.com/fruits-that-taste-sour


Is there a way to do a rule that will take the wild card "fruits-that-taste-*" and direct all of those to the new domain -- without having to type each page

Something like this (of course I am not using the right syntax:

Redirect 301 http://www.olddomain.com/fruits-that-taste-* http://www.newdomain.com/*

Not sure if this is at all possible.  Looking at my existing htaccess file I see that it is already using RewriteRule for other items.  I read somewhere that RewriteRule is used for more elaborate directs.  So it is available if it helps with this solution.

Thanks!

Rowby
0
Comment
Question by:Rowby Goren
  • 2
  • 2
4 Comments
 
LVL 13

Accepted Solution

by:
duncanb7 earned 500 total points
ID: 39765650
Could your try this from redirecting site of  sitea to siteb on your .htaccess. file  ?

RewriteEngine On
RewriteCond %{HTTP_HOST} ^.*sitea.com$ [NC]
RewriteRule ^(.*)$ http://siteb.com/$1 [R=301,L]


Duncan
0
 
LVL 9

Author Comment

by:Rowby Goren
ID: 39765854
Hi Duncak.

Thanks  I will do the test and get back to you later today.

Rowby
0
 
LVL 9

Author Closing Comment

by:Rowby Goren
ID: 39810109
Hi Duncan,

Thanks for the answer.  Sorry for the delay in awarding points.

Rowby
0
 
LVL 13

Expert Comment

by:duncanb7
ID: 39811669
thanks for your pt,

Have a nice day

Duncan
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now