Apache redirection Problems

Source: Internet
Author: User
Access test or testb and redirect to www.test.com. How can I write? I wrote RedirectMatch301test. * When www.test.com is accessed, access to testb will be redirected to www. test. comb, but what is actually needed is www.test.com... access/test or/test/B to redirect to the http://www.test.com, how to write?
When I write a RedirectMatch 301/test. * http://www.test.com,
Access to/test/B will be redirected to http://www.test.com/ B, but the website is http://www.test.com.

In addition, how do I write a redirection if a url cannot be matched?
For example, when the request is/admin, no redirection is performed, and all requests except/admin are redirected.

Reply content:

Access/test or/test/B to redirect to the http://www.test.com, how to write?
When I write a RedirectMatch 301/test. * http://www.test.com,
Access to/test/B will be redirected to http://www.test.com/ B, but the website is http://www.test.com.

In addition, how do I write a redirection if a url cannot be matched?
For example, when the request is/admin, no redirection is performed, and all requests except/admin are redirected.

For more information about the Apache Rewrite module, see

Http://man.lupaworld.com/content/manage/Apache2.2_chinese_manual/mod/mod_rewrite.html

301 redirection example

RewriteRule ^ test/B /? $ Http://www.test.com/[L, r= 301]

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.