Solved

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

Posted on 2014-01-08
4
232 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ProxyPass - Problem 5 148
Virtual host in apache 31 90
Need To Change Centos 6 Timestamp Form In Log File 24 70
ignore other .htaccess 2 43
Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

813 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

18 Experts available now in Live!

Get 1:1 Help Now