URL rewriting displays different content depending on the domain name

Source: Internet
Author: User

Currently apache pseudo static URL rewrite. htaccess is the following rule:
http://www.abc.com---> index.php
http://www.abc.com/late/--->./filedir/late.php?p=1
http://www.abc.com/popular/--->./filedir/popular.php?p=1
Http://www.abc.com/down/name-id/--->./filedir/detail.php?id=number
Http://www.abc.com/cat/catname-catid/--->./filedir/cat.php?catid=number

Http://www.abc.com/bb--->./filedir/bb.php
http://www.abc.com/bblate/--->./filedir/bblate.php?p=1
http://www.abc.com/bbpopular/--->./filedir/bbpopular.php?p=1
Http://www.abc.com/bdown/name-id/--->./filedir/bbdetail.php?id=number
Http://www.abc.com/bcat/bcatname-catid/--->./filedir/bbcat.php?bbcat.php?catid=number

Now to add a level two domain name bb.abc.com also point to the www.abc.com server, and the domain name after the path to the same as the www.abc.com form, namely
http://bb.abc.com--->./filedir/bb.php
http://bb.abc.com/late/--->./filedir/bblate.php?p=1
http://bb.abc.com/popular/--->./filedir/bbpopular.php?p=1
Http://bb.abc.com/down/name-id/--->./filedir/bbdetail.php?id=number
Http://bb.abc.com/cat/bcatname-catid/--->./filedir/bbcat.php?bbcat.php?catid=number

How do you write this? htaccess URL rewrite rules? Display different content by judging the domain name

Reply content:

Currently apache pseudo static URL rewrite. htaccess is the following rule:
http://www.abc.com---> index.php
http://www.abc.com/late/--->./filedir/late.php?p=1
http://www.abc.com/popular/--->./filedir/popular.php?p=1
Http://www.abc.com/down/name-id/--->./filedir/detail.php?id=number
Http://www.abc.com/cat/catname-catid/--->./filedir/cat.php?catid=number

Http://www.abc.com/bb--->./filedir/bb.php
http://www.abc.com/bblate/--->./filedir/bblate.php?p=1
http://www.abc.com/bbpopular/--->./filedir/bbpopular.php?p=1
Http://www.abc.com/bdown/name-id/--->./filedir/bbdetail.php?id=number
Http://www.abc.com/bcat/bcatname-catid/--->./filedir/bbcat.php?bbcat.php?catid=number

Now to add a level two domain name bb.abc.com also point to the www.abc.com server, and the domain name after the path to the same as the www.abc.com form, namely
http://bb.abc.com--->./filedir/bb.php
http://bb.abc.com/late/--->./filedir/bblate.php?p=1
http://bb.abc.com/popular/--->./filedir/bbpopular.php?p=1
Http://bb.abc.com/down/name-id/--->./filedir/bbdetail.php?id=number
Http://bb.abc.com/cat/bcatname-catid/--->./filedir/bbcat.php?bbcat.php?catid=number

How do you write this? htaccess URL rewrite rules? Display different content by judging the domain name

Find a method:
Rewritecond%{http_host} ^bb.abc.com$
Rewriterule ^ (/)? $./filedir/bb.php [L]
Rewritecond%{http_host} ^bb.abc.com$
Rewriterule ^late/$./filedir/bblate.php?p=1 [L]

Also thank Nathan_wu

Serveralias bb.abc.com

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.