. Htaccess domain name rewriting problems

Source: Internet
Author: User
. Htaccess domain name rewriting problem? For example, the same php space is supported and two domain names www.aaa.com and www.bbb.com are bound at the same time. if the space contains at least the following files and directories (folders): (note: Is there a problem about rewriting the domain name of javasr. htaccess?
For example, the same php space is supported and two domain names www.aaa.com and www.bbb.com are bound at the same time;
Assume that the space contains at least the following files and directories (folders ):
(Note: The directories or files under the root directory and the file names under bbb may be the same, but the content may not be the same. all files cannot be shared)
Index. php
Text/about.html
Tp/logo.jpg
Aaa. php
Error.html
Robots.txt

Bbb/index. php
Bbb/text/about.html
Bbb/tp/logo.jpg
Bbb/bbb. php
Bbb/error.html



When you use an aaa.com or www.aaa.com domain name to start accessing, the access is normal.
(Directly access the Directory, file, and home page under the root directory of the space without rewriting), for example:
Point to the index. php page when the http://www.AAA.com or http://aaa.com is accessed,
If you want to directly access the files in the corresponding folder under the root directory,
For example, the http://www.aaa.com/text/about.html is also the about.html page under the textfile folder under the root directory,
Click the link on the page;


When you use a domain name starting with bbb.com for access, rewrite (point to) all directories or files in the bbb folder of the root directory. for example:
When accessed with a http://www.bbb.com or http://bbb.com, the address bar appears as a http://www.bbb.com (domain display unchanged) but the actual access is the bbb/index. php page;
To access the directory or file in a format similar to http://www.bbb.com/directory/directory/file name, rewrite (point to) the directory or file in the bbb folder of the root directory;
For example:
When the http://www.bbb.com/bbb.php address bar is displayed as a http://www.bbb.com/bbb.php (the domain name is displayed unchanged) but the actual access is the http://www.bbb.com/bbb/bbb.php page;
When the http://www.bbb.com/text/about.html address bar is displayed as a http://www.bbb.com/text/about.html (the domain name is displayed unchanged) but the actual access is the http://www.bbb.com/bbb/text/about.html page;
This type of push is intended;
The link and address on the page are also normal, and are the corresponding pages or files under the bbb directory;

It is best to refer the corresponding error.html page when there is no matching page;
For example, when the http://www.bbb.com/aaa.php is used because it is rewritten to the bbb/folder without the aaa. php file (although this file is available in the root directory), it will jump to the bbb/error.html page ??


There will always be problems with what you learn to write or copy online,
Hope you will receive your advice !!!




------ Solution --------------------
You don't know what you want
What url do you want to change?
------ Solution --------------------
Create a. htaccess file in the bbb folder

RewriteEngine on
RewriteRule ^ bbb/bbb. php $ bbb. php

Related Article

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.