Solved

how to create redirect 301 and change url

Posted on 2008-10-26
1
332 Views
Last Modified: 2010-03-04
hello,
I have hosted web site. and all are before in same server.
any hosted web site can before have 2 url :
http://www.domaine.com/<hosted-web-site>/
or
http://<hosted-web-site>/.domaine.com/

and this because i have make this in my conf apache :
---------------------------------------------------------------------------------
RewriteMap              lowercase                               int:tolower
RewriteRule             ^(.*)                                   %{HTTP_HOST}$1  

RewriteCond       /data/www/$1/${lowercase:$2}           -d
RewriteRule       ^www\.([^./]+)\.[^/.]+/([^/]+)(.*)$    /data/www/$1/${lowercase:$2}$3         [L]

RewriteCond       /data/www/$1/${lowercase:$2}           -d
RewriteRule       ^([^/]+)\.[^/.]+/([^/]+)(.*)$         /data/www/$1/${lowercase:$2}$3         [L]

RewriteRule       ^([^/]+)\.([^/.]+)\.[^/]+(.*)$        /data/www/$2/$1$3                [L]
RewriteRule       ^([^./]+)\.[^/.]+(.*)$                 /data/www/$1/www$2               [L]
---------------------------------------------------------------------------------

But now I have move all my www.domaines.com to other server
and all web site I hosted free are hosted in others servers.
this create problem ! and now all url "http://www.domaine.com/<hosted-web-site>/"   not work
normal, because the www is now in other server.

my questions are:
what can I make for solve this problem ?
what make for make 301 redirect but only for hosted web site and not all for all error page ?

cordialy
thierry

0
Comment
Question by:thierry91
1 Comment
 
LVL 27

Accepted Solution

by:
caterham_www earned 500 total points
Comment Utility
> http://www.domaine.com/<hosted-web-site>/
> what make for make 301 redirect but only for hosted web site and not all for all error page ?

Check, if the first part of an URL-path looks like a http_host

RewriteRule ^/(www\.)?[^.]+\.[a-z]{2,4}(/.*) http://..... [R=301,L]
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now