basic domain .htaccess redirection

Posted on 2007-09-30
Last Modified: 2012-05-05

I am in a shared hosting server

/public_html/ ( root for
/publc_html/a/ (root for
/public_html/b/ (root for
total 50 domains

I edit /public_html/.htaccess

RewriteCond %{HTTP_HOST} ^(www\.)?domaina\.com [NC]
RewriteRule ^(.*)$ [R=302,L]

RewriteCond %{HTTP_HOST} ^(www\.)?domainb\.com [NC]
RewriteRule ^(.*)$ [R=302,L]

......... etc

My question:
So is it I have to do these 2 lines for 50 times (for 50 domains)...
Is there better way of doing this?
minimize my works?
I am willing to clarify my question...

Question by:LearningLearning
    LVL 43

    Accepted Solution

    RewriteCond %{HTTP_HOST} ^(www\.)?domain(.)\.com [NC]
    RewriteRule ^(.*)$ [R=302,L]
    LVL 43

    Expert Comment

    But You my also match against the directory(one letter exactly?)

    RewriteCond ^(.)/.*$ [R=302,L]

    Author Comment

    actually all the domains are different name.
    So is it I have to add 50 * 2 lines in the .htaccess?
    or there are 2 lines codes that will make the job easier?
    LVL 43

    Expert Comment

    > actually all the domains are different name.
    I understand they are totally different like ?
    Maybe then subfolders(You said they're a/ b/ c/) have something in common with redirection URL?

    If nothing in common, You need those 50(*2) entries...

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL ( several years ago, it seemed like now was a good time to updat…
    Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
    The viewer will learn how to dynamically set the form action using jQuery.
    The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

    728 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

    14 Experts available now in Live!

    Get 1:1 Help Now