Printer Friendly Version Print this thread
Email this thread to a friend eMail this thread to a friend
Featured Web Site Template

Hundreds More at Free Site Templates.com!

Web Site Partners
Sponsored Links
Jet City Software
 
Whos Here ?
There are 0 guests and 1 members in the forums right now.
Reflects user activity within the last 5 minutes
Moderator(s): Prowler, jcokos
Member Message

suthra
Joined: Mar 25, 2004
# Posts: 37

View the profile for suthra Send suthra a private message

Posted: 2006-Mar-20 13:25
Edit Message Delete Message Reply to this message

Hi, Iam not a unix guy, Recently we shifted our servers to a new server for a particular section of our site.
so the new urls became:
server.mydomain.com/foldera From mydomain.com/foldera

Now , we need to redirect all contents from
mydomain.com/foldera
to
server.mydomain.com/foldera

I tried this code
[code]
RewriteCond %{HTTP_HOST} ^mydomain.com/foldera
RewriteRule (.*) http://www.server.mydomain.com/foldera/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www.mydomain.com/foldera
RewriteRule (.*) http://www.server.mydomain.com/foldera/$1 [R=301,L]

[code]
But of no use

Would be grateful for any help :)

Sarathy.s



Prowler
Staff
Joined: Aug 14, 2000
# Posts: 1795

View the profile for Prowler Send Prowler a private message

Posted: 2006-Mar-21 05:06
Edit Message Delete Message Reply to this message

Have you turned on the Rewrite engine ?

Add this at the beginning of the directives:
RewriteEngine on





suthra
Joined: Mar 25, 2004
# Posts: 37

View the profile for suthra Send suthra a private message

Posted: 2006-Mar-21 05:50
Edit Message Delete Message Reply to this message

Hi Prowler, Yeah I added that line, but still of no use sad



Prowler
Staff
Joined: Aug 14, 2000
# Posts: 1795

View the profile for Prowler Send Prowler a private message

Posted: 2006-Mar-21 05:57
Edit Message Delete Message Reply to this message

Try this:



Code: [copy]




Remove the * in the 'http'. (this was added to prevent the forum software from mangling the code)



suthra
Joined: Mar 25, 2004
# Posts: 37

View the profile for suthra Send suthra a private message

Posted: 2006-Mar-21 11:35
Edit Message Delete Message Reply to this message

But its similar to the original code ?



SportsGuy
Staff
Joined: Aug 30, 2002
# Posts: 3600

View the profile for SportsGuy Send SportsGuy a private message

Posted: 2006-Mar-21 12:39
Edit Message Delete Message Reply to this message

With this stuff a single character or even a space can make the difference.

I personally have recieved and tried code from posters in this forum - worked like a charm.



suthra
Joined: Mar 25, 2004
# Posts: 37

View the profile for suthra Send suthra a private message

Posted: 2006-Mar-21 13:04
Edit Message Delete Message Reply to this message

I dont know how this happened.,
But i added
[code]
Redirect 301 /foldera http://server.mydomain.com/foldera
[code]
in the .htacess contents
and now the match works :D





g1smd
Staff
Joined: Jul 28, 2002
# Posts: 10438

View the profile for g1smd Send g1smd a private message

Posted: 2006-Mar-21 21:22
Edit Message Delete Message Reply to this message

This is what you needed.

RewriteCond %{HTTP_HOST} ^mydomain\.com
RewriteRule ^foldera(.*)$
http://server.mydomain.com/foldera$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.mydomain\.com
RewriteRule ^foldera(.*)$
http://server.mydomain.com/foldera$1 [R=301,L]


Your original code is supposed to test "HTTP_HOST" so the first line should NOT contain any folder names.

You were redirecting to a URL that also included a www on the front. That was also incorrect.

Your redirect didn't specify the names of any subpages when the redirect was issued.

[ Message was edited by: JimBot 03/24/2006 01:29 pm ]





suthra
Joined: Mar 25, 2004
# Posts: 37

View the profile for suthra Send suthra a private message

Posted: 2006-Mar-24 10:44
Edit Message Delete Message Reply to this message

Thanks a lot g1smd.,
But, wont your code redirect mydomain.com to> server.mydomain.com/foldera?

Thanks again
Sarathy.s



g1smd
Staff
Joined: Jul 28, 2002
# Posts: 10438

View the profile for g1smd Send g1smd a private message

Posted: 2006-Mar-24 21:32
Edit Message Delete Message Reply to this message

No, the RewriteRule is testing only for ^foldera(.*)$ so it only works for a folder (or page name) URL that starts with foldera...




You are not permitted to post messages in this forum or topic, because of one or more of the following reasons:
  1. You have not yet logged in, or registered properly as a member
  2. You are a member, but no longer have posting rights.
  3. This is a private forum, for which you do not have permissions.

If you are a recent member, it's possible that you simply have not yet confirmed your account. Please check your email for a message entitled 'JimWorld Forums: Confirm Your Account' and follow the instructions contained within.

If you cannot find this message, click here to Re-Send it.

If you are still experiencing problem, please read the Login Assistance Article for some advice on what may be causing your login not to work properly.

Switch to Advanced Editor and ... Create a New Topic or Reply to this Thread

New posts Forum is locked
© 1995  ·  iWeb, Inc  ·  DBA JimWorld Productions