网络营销电子商务研究中心  
How to buy the best prescription safety glasses in Canada? Let's study!
Go Back   网络营销电子商务研究中心 > 网站建设 > 建站交流
User Name
Password
 
FAQ Members List Calendar Cheap Glasses Mark Forums Read

建站交流 讨论网站建设的基本方法、技巧、空间问题讨论、域名交流、
资源分享、技术交流,站长们经常进来看看噢!

Reply
 
Thread Tools Display Modes
  #1   IP: 222.184.115.77
Old 2007-08-18, 01:07 AM
smiling smiling is offline
高级会员
 
Join Date: 2006-02-12
Posts: 502
smiling 正向着好的方向发展
Default 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]
Reply With Quote
  #2   IP: 222.184.115.77
Old 2007-08-18, 01:14 AM
smiling smiling is offline
高级会员
 
Join Date: 2006-02-12
Posts: 502
smiling 正向着好的方向发展
Default

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:
Quote:
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:
Quote:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain\.com
RewriteRule (.*) http://www.domain.com/$1 [R=301,L]
PHP 4 and PHP 5
Single Page Redirect:
Quote:
<?php
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://www.new-url.com/');
?>
Canonical Hostname Redirect (non-www to www):
Quote:
<?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:
Quote:
<%
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:
Quote:
<%
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
%>
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Volume! What to do about domains? sunshine Google Adsense 0 2006-12-11 09:41 AM

Prescription-glasses.com offers prescription glasses online at discount prices.
All times are GMT +8. The time now is 03:22 AM.


Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.