More Virtual Promote ... Gazette · Webmaster & SEO Tools · Scumware.com · Free Website Templates

SEF

Search Engine Forums
Helping to make the Web - Since 1998
Virtual Promote Member Spotlight
Buy and Sell Text Links

No fees to the buyer or seller. Sites is genuinely 100% free. Increase tha (bsl)

Login Password Forget your password?    Trouble Logging In?
.
Forums Index Active Topics New Topics My Topics Search My Profile Register Inbox   Rules & TOS
.
 
Forum Index · Search Engine Forums · Optimizing Your Website for the Search Engines · General Search Engine Optimization · Advanced 301 Redirect Code for Subdomains
 
Add to hotlist
Reply to this thread Create a New Topic in this forum
Mark This Forum Read
Printer Friendly Version Print this thread
Email this thread to a friend eMail this thread to a friend  
Moderator(s): Dinkar, Logan
Previous Topic Next Topic
Member Message

vanachte
Joined: Feb 10, 2004
# Posts: 379

View the profile for vanachte Send vanachte a private message

Posted: 03/27/2008 09:27 am
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: 379

View the profile for vanachte Send vanachte a private message

Posted: 03/27/2008 11:24 am
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
Moderator
Joined: Jul 28, 2002
# Posts: 10060

View the profile for g1smd Send g1smd a private message

Posted: 03/27/2008 06:00 pm
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: 379

View the profile for vanachte Send vanachte a private message

Posted: 04/04/2008 10:54 am
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
Moderator
Joined: Aug 30, 2002
# Posts: 3550

View the profile for SportsGuy Send SportsGuy a private message

Posted: 04/05/2008 08:23 am
Edit Message Delete Message Reply to this message

301 redirecting explained here


 
Forum Index · Search Engine Forums · Optimizing Your Website for the Search Engines · General Search Engine Optimization · Advanced 301 Redirect Code for Subdomains
Who's Online?
There are 172 guests and 1 members in the forums right now.
Reflects user activity within the last 5 minutes
Previous Topic Next Topic
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



Related Forum Topics
  1. New Google Analytics Tracking Code (ga.js) (In: Google)
  2. .htaccess/301 redirects not working - what (In: General Search Engine Optimization)
  3. 301 redirect problem (In: General Search Engine Optimization)



© 1995 - 2006  ·  iWeb, Inc  ·  DBA JimWorld Productions