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

谁帮我发个.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
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
鸿蒙原生应用随机诗词鸿蒙原生应用随机诗词Feb 19, 2024 pm 01:36 PM

想了解更多关于开源的内容,请访问:51CTO鸿蒙开发者社区https://ost.51cto.com运行环境DAYU200:4.0.10.16SDK:4.0.10.15IDE:4.0.600一、创建应用点击File->newFile->CreateProgect。选择模版:【OpenHarmony】EmptyAbility:填写项目名,shici,应用包名com.nut.shici,应用存储位置XXX(不要有中文,特殊字符,空格)。CompileSDK10,Model:Stage。Device

rewritecond的用法介绍rewritecond的用法介绍Aug 31, 2023 am 11:54 AM

rewritecond的用法可以根据特定的条件来决定是否应该应用某个重写规则。RewriteCond指令支持多种条件,检查HTTP请求的来源IP地址、检查HTTP请求的来源域名、检查HTTP请求的User-Agent头部、检查请求的HTTP方法、检查请求的查询字符串、检查请求的文件类型等等。

bbs指的是什么意思bbs指的是什么意思Mar 06, 2024 pm 04:14 PM

bbs全称Bulletin Board System,中文意思为“电子公告板系统”,一般是指网络论坛,是一个和网络技术有关的网上交流场所。其特点:信息量大、信息更新快、交互性强。

comcn和com有什么区别comcn和com有什么区别May 12, 2023 pm 04:08 PM

comcn和com的区别:1、comcn和com在含义等方面有区别,在访问速度上没有区别;2、comcn属于国际域名,是全球通用顶级域名,供商业机构使用,而cn是中国的公司域名,国内商业机构,国内域名,必须企业才可以备案;3、搜索的优先顺序是cn先会去搜索.cn,找到.cn服务器后,再由.cn服务器搜索.com;4、cn由cnnic中国互联网中心管理,com的管理机构在国外。

bbs是什么意思?bbs是什么意思?Jan 04, 2024 am 10:56 AM

BBS的英文全称是“Bulletin Board System”,中文是“电子公告板系统”。在国内一般称为网络论坛,它早期与一般街头和校园内的公告板性质相同,只不过是通过电脑来传播或获得消息而已。 一直到个人计算机开始普及之后,有人尝试将苹果计算机上的BBS转移到个人计算机上,BBS才开始渐渐普及开来。

bbs是什么意思bbs是什么意思Jan 14, 2021 pm 05:52 PM

bbs全称Bulletin Board System,中文意思为“电子公告板系统”,一般是指网络论坛,是一个和网络技术有关的网上交流场所;BBS被泛指网络论坛或网络社群。 BBS的特点:信息量大、信息更新快、交互性强。

Linux系统中grep如何使用?Linux系统中grep如何使用?Feb 19, 2024 pm 03:54 PM

  在Linux中,grep是一个非常常见和重要的工具,是每一个专业运维工程师必须掌握的命令,因为通过它可以快速地查找和过滤文件中的内容,那么Linux系统中grep如何使用?下面是常见用法介绍,一起来看看吧。  1、基本用法grep命令主要用于在文件中搜索指定模式的行。例如,要在文件file.txt中查找包含"example"的行,可以使用grep命令来实现。  grep‘example’file.txt  grep将输出所有包含’example’的行。 

PHP中endfor关键字的用法和示例PHP中endfor关键字的用法和示例Jun 28, 2023 pm 09:09 PM

PHP中endfor关键字的用法和示例在PHP编程中,for循环是一个常用的控制结构,用于重复执行一段代码块,可以通过指定初始值、循环条件和增量的方式来控制循环次数。而在PHP中,endfor关键字则是用于结束for循环的一种特殊语法。在一般的for循环中,我们经常使用大括号({})将循环体包裹起来,然后通过使用关键字break来提前终止循环。但是,PHP提

See all articles

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)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools