Home > Backend Development > PHP Tutorial > .htaccess域名跳转文件如何写

.htaccess域名跳转文件如何写

WBOY
Release: 2016-06-13 10:45:08
Original
1363 people have browsed it

.htaccess域名跳转文件怎么写?
php空间,支持伪静态跳传
比如一个支持php空间同时绑定有3个域名
www.aaa.com
http://www.xxx.com
bbs.aaa.com;

当用www.xxx.com来访问时,自动跳转至www.aaa.com(地址栏域名显示成www.aaa.com)指向空间主页面index.php。

当bbs.aaa.com来访问时,指向www.aaa.com/bbs.php 子页面;(地址栏域名显示成bbs.aaa.com)。

------解决方案--------------------
加个重写就好了,bbs.aaa.com重写到www.aaa.com/bbs.php
------解决方案--------------------
你大概理解一下htaccess里的这几个语句, 也许能找到解决方法
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt|user_guide/)
RewriteRule ^(.*)$ /index.php/$1 [L]
------解决方案--------------------
# Use PHP5 Single php.ini as default
AddHandler application/x-httpd-php5s .php
RewriteEngine On
RewriteCond %{HTTP_HOST} ^ganfulejiaonang\.xyz315\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.ganfulejiaonang\.xyz315\.com$
RewriteRule ^/?$ "http\:\/\/ganfulejiaonang\.xyz120\.net\/" [R=301,L]

Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template