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 ?
Reflects user activity within the last 5 minutes
Moderator(s): Dinkar, Logan
Member Message

vanachte
Joined: Feb 10, 2004
# Posts: 404

View the profile for vanachte Send vanachte a private message

Posted: 2008-Mar-27 17:27
Edit Message Delete Message Reply to this message

Hi There,

I have tried searching but for some reason cant seem to find a post that has this question answered - hopefully I didn't accidentally skip by one.

Basically I am trying to get code for the .htaccess file that will do the following.

301 redirect ALL sub domain requests that have the WWW to that without the WWW.

For instance, if someone tries to access:

http://www.subdomain.topleveldomain.com/* I want it to 301 to
http://subdomain.topleveldomain.com/*

The site this is for has dozens and dozens of sub domains, so if there is code that would work using a wildcard for the sub domain, that would be ideal.

Many thanks in advance



vanachte
Joined: Feb 10, 2004
# Posts: 404

View the profile for vanachte Send vanachte a private message

Posted: 2008-Mar-27 19:24
Edit Message Delete Message Reply to this message

I actually am looking for this info to help out someone else. Here is a snippet he asked me to add to this post. This is what he has done, thus far, and it does not work yet.


Code: [copy]





Basically what this is saying is:
1. If the url is not www.demo.com*
2. If the url is not empty
3. If the url MATCHES www.*.demo.com

Then

4. Rewrite www.*.demo.com to be *.demo.com



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

View the profile for g1smd Send g1smd a private message

Posted: 2008-Mar-28 02:00
Edit Message Delete Message Reply to this message

Dangerous code.

The [R] gives a 302 redirect. You need [R=301,L] here.

The $1 needs to be http://$1 at the very least, too.

Finally, the RewriteRule cannot see the www. part of the URL. It can only see the folder and filepath without a leading / on it.

Correct those problems and post your best attempt.






vanachte
Joined: Feb 10, 2004
# Posts: 404

View the profile for vanachte Send vanachte a private message

Posted: 2008-Apr-04 18:54
Edit Message Delete Message Reply to this message

Many thanks!! I have sent your reply over to the programmer - will post again when we know if it worked along with the actual code used.

Happy Friday!



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

View the profile for SportsGuy Send SportsGuy a private message

Posted: 2008-Apr-05 16:23
Edit Message Delete Message Reply to this message

301 redirecting explained here


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