Home Backend Development PHP Tutorial 哪位高手帮小弟我发个.htaccess域名传向文件?为什么这个不行

哪位高手帮小弟我发个.htaccess域名传向文件?为什么这个不行

Jun 13, 2016 pm 01:45 PM
bbs com example rewritecond

谁帮我发个.htaccess域名传向文件?为什么这个不行?
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.xxx.com$ [OR]RewriteCond %{HTTP_HOST} ^xxx.com$ 
RewriteRule ^/?$ "http\:\/\/www\.example\.com" [R=301,L]

谁帮我发个.htaccess域名传向文件?为什么这个不行?

同时绑定在一个空间里的有五个域名1.www.example.com,2.www.xxx.com,3.xxx.com,4.bbs.example.com;5.news.example.com;
要实现的功能:
当用www.xxx.com,xxx.com来访问时,自动跳转至www.example.com(地址栏域名显示成www.example.com)指向空间主页面index.php。
当bbs.example.com来访问时,指向www.example.com/bbs 子页面;(地址栏域名显示成bbs.example.com)。
当news.example.com来访问时,指向www.example.com/news 子页面;(地址栏域名显示成news.example.com)。



------解决方案--------------------
域名跳转没试过。。。是不是你没开启.htaccess目录识别?
子页跳转的话可以用这个
RewriteCond %{HTTP_HOST} ^bbs.example.com$
RewriteCond %{REQUEST_URI} !^/bbs/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /bbs/$1
RewriteCond %{HTTP_HOST} ^bbs.example.com$
RewriteRule ^(/)?$bbs/index.php [L]
------解决方案--------------------
域名转向?是不是就是跳转呢?

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hongmeng native application random poetry Hongmeng native application random poetry Feb 19, 2024 pm 01:36 PM

To learn more about open source, please visit: 51CTO Hongmeng Developer Community https://ost.51cto.com Running environment DAYU200:4.0.10.16SDK: 4.0.10.15IDE: 4.0.600 1. To create an application, click File- >newFile->CreateProgect. Select template: [OpenHarmony] EmptyAbility: Fill in the project name, shici, application package name com.nut.shici, and application storage location XXX (no Chinese, special characters, or spaces). CompileSDK10, Model: Stage. Device

Introduction to the usage of rewritecond Introduction to the usage of rewritecond Aug 31, 2023 am 11:54 AM

The usage of rewritecond can determine whether a certain rewrite rule should be applied based on specific conditions. The RewriteCond instruction supports a variety of conditions, including checking the source IP address of the HTTP request, checking the source domain name of the HTTP request, checking the User-Agent header of the HTTP request, checking the HTTP method of the request, checking the query string of the request, and checking the file type of the request. etc.

What is the difference between comcn and com What is the difference between comcn and com May 12, 2023 pm 04:08 PM

The difference between comcn and com: 1. There are differences between comcn and com in terms of meaning, but there is no difference in access speed; 2. comcn is an international domain name and is a global top-level domain name for use by commercial institutions, while cn is a Chinese company domain name , domestic commercial institutions, domestic domain names, only enterprises can register; 3. The search priority is that cn will search for .cn first. After finding the .cn server, the .cn server will then search for .com; 4. cn is provided by cnnic China Internet Center Management, com's management organization is abroad.

What does bbs mean? What does bbs mean? Jan 04, 2024 am 10:56 AM

The full English name of BBS is "Bulletin Board System", and the Chinese name is "Electronic Bulletin Board System". In China, it is generally called an Internet forum. In its early days, it had the same nature as bulletin boards on the streets and on campus, except that it was used to spread or obtain information through computers. It was not until personal computers began to become popular that someone tried to transfer the BBS on Apple computers to personal computers, and BBS began to gradually become popular.

What does bbs mean? What does bbs mean? Mar 06, 2024 pm 04:14 PM

The full name of bbs is Bulletin Board System, which means "electronic bulletin board system" in Chinese. It generally refers to an online forum and is an online communication place related to network technology. Its characteristics: large amount of information, fast information update, and strong interactivity.

what does bbs mean what does bbs mean Jan 14, 2021 pm 05:52 PM

The full name of bbs is Bulletin Board System, which means "electronic bulletin board system" in Chinese. It generally refers to an online forum and is an online communication place related to network technology; BBS generally refers to an online forum or online community. The characteristics of BBS: large amount of information, fast information update, and strong interactivity.

How to use grep in Linux system? How to use grep in Linux system? Feb 19, 2024 pm 03:54 PM

In Linux, grep is a very common and important tool. It is a command that every professional operation and maintenance engineer must master, because it can quickly find and filter the contents of files. So how to use grep in Linux system? The following is Let’s take a look at the common usage introduction. 1. Basic usage The grep command is mainly used to search for lines of a specified pattern in files. For example, to find the line containing "example" in the file file.txt, you can use the grep command. grep 'example' file.txt grep will output all lines containing 'example'.​

Usage and examples of endfor keyword in PHP Usage and examples of endfor keyword in PHP Jun 28, 2023 pm 09:09 PM

Usage and examples of the endfor keyword in PHP In PHP programming, the for loop is a commonly used control structure, which is used to repeatedly execute a block of code. The number of loops can be controlled by specifying the initial value, loop condition, and increment. In PHP, the endfor keyword is a special syntax used to end a for loop. In a general for loop, we often use braces ({}) to wrap the loop body, and then terminate the loop early by using the break keyword. However, PHP provides

See all articles