年年我发



返回   年年我发 > 网站建设 > 建站交流
用户名
密码
 
注册账号 论坛帮助 会员列表 日历事件网赚工具 标记版面已读

建站交流 讨论网站建设的基本方法、技巧、空间问题讨论、域名交流、
资源分享、技术交流,站长们经常进来看看噢!
注意:不要留下你的网站链接!

回复
 
主题工具 搜索本主题 显示模式
  #1   IP: 222.184.115.77
旧 2007-08-18, 01:07 AM
smiling smiling 当前离线
高级会员
 
注册日期: 2006-02-12
帖子: 528
现金: 3821 元
资产: 3821 元
声望: 10 smiling 正向着好的方向发展
默认 How to redirect more domains in one folder via .htaccess

i wanted to redirect because all domains point to one directory and now every domain pints to its directory

where the main domain is other

and here it is

RewriteEngine On

RewriteCond %{HTTP_HOST} ^domain2.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain2.com$
RewriteRule ^/?$ http://www.domain2/shkupi [R=301,L]
回复时引用此帖

wellcome to www.0058.net
  #2   IP: 222.184.115.77
旧 2007-08-18, 01:14 AM
smiling smiling 当前离线
高级会员
 
注册日期: 2006-02-12
帖子: 528
现金: 3821 元
资产: 3821 元
声望: 10 smiling 正向着好的方向发展
默认

How to do 301 redirects in Apache .htaccess, PHP,ASP

Apache Web Server .htaccess file
Apache .htaccess files let you override the Web server configuration on a per-directory hierarchial basis, and are instrumental in the creation of proper 301 redirects.

Single Page Redirect:
引用:
Redirect 301 /old/url /new/url

or

Redirect Permanent /old/ur /new/url

Canonical Hostname Redirect (non-www to www):
This solution will redirect any page requested via a non-www domain to the same URL with the www domain, and as such it can be placed in the DocumentRoot of your site and will be enforced globally:
引用:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain\.com
RewriteRule (.*) http://www.domain.com/$1 [R=301,L]


PHP 4 and PHP 5
Single Page Redirect:
引用:
<?php
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://www.new-url.com/');
?>

Canonical Hostname Redirect (non-www to www):
引用:
<?php
if (substr($_SERVER['HTTP_HOST'],0,3) != 'www') {
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://www.'.$_SERVER['HTTP_HOST']
.$_SERVER['REQUEST_URI']);
}
?>

Active Server Pages (ASP)
Single Page Redirect:
引用:
<%
Response.Status="301 Moved Permanently"
Response.AddHeader='Location','http://www.new-url.com/'
%>


Canonical Hostname Redirect (non-www to www):
This code should be inserted into a global include file or any ASP script which is executed for every page on the site before the page output begins:
引用:
<%
If InStr(Request.ServerVariables("SERVER_NAME"),"www") = 0 Then
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www."
& Request.ServerVariables("HTTP_HOST")
& Request.ServerVariables("REQUEST_URI")
Response.End
End if
%>
回复时引用此帖
回复


当前查看此主题的会员: 1 (0 位会员和 1 位游客)
 
主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

论坛启用 BB 代码
论坛禁用 表情符号
论坛启用 [IMG] 代码
论坛禁用 HTML 代码
论坛跳转

相似的主题
主题 主题作者 版面 回复 最后发表
Volume! What to do about domains? sunshine Google Adsense 0 2006-12-11 09:41 AM


所有时间均为北京时间. 现在的时间是 07:11 PM, Free Patent & Patent Ideas


Powered by vBulletin 3.5.2 Chinese Exhibition Happy New Year
©2000 - 2008,Jelsoft Enterprises Ltd  Desiccant Molecular Sieve Weight Loss Bentonite Trade Manager