So a client of mine has about 150 domain names, all of them he is wanting to redirect to the primary domain name.
I have done something like this for each domain name in the .htaccess file:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain12.com$ [NC]
RewriteRule ^(.*)$ http://www.primarydomain.com/$1 [R=301,L]

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.domain12.com$ [NC]
RewriteRule ^(.*)$ http://www.primarydomain.com/$1 [R=301,L]

Now this works if you are in the root index (home page). As soon as you go to something like www.domain12.com/about then it just loads the page but doesn't redirect the url. Does anyone know what's causing this?

Recommended Answers

All 5 Replies

Member Avatar for LastMitch

@AmieCutie

Now this works if you are in the root index (home page). As soon as you go to something like www.domain12.com/about then it just loads the page but doesn't redirect the url. Does anyone know what's causing this?

Try to used this Mod Rewrite Generator:

http://www.generateit.net/mod-rewrite/

Yea, that doesn't help. :(

Member Avatar for LastMitch

Yea, that doesn't help. :(

How does it not work?

You want to redirect this page about to the index

www.domain12.com/about

This is how it should look like:

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^about\.html$ "http\:\/\/www\.domain12\.com\/about\.php" [R=301,L]

The Mod Rewrite Generator give you you these codes.

I'm not see the issue you are having? Unless you are not very specific with what you are intending to do.

I have the indexes working like this:
www.domain12.com redirects to www.primarydomain.com

I need to redirect stuff like this now:
www.domain12.com/about to www.primarydomain.com/about
www.domain12.com/videos/interview01 to www.primarydomain.com/videos/interview01

Each of the domain names is parked at the primary domain name that my client is using. I did a 301 redirect like in my original posting but it only seems to effect the root/index domain, not the sub-pages and sub-folders.

Found the problem! Someone stuffed other .htaccess files into every sub directory. I deleted those and averything works!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.