Web Hosting Talk


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : htaccess toughie
Reply

Programming Discussion Discussions related to web programming languages and other related issues. Topics may include configuration, optimization, practical usage and database connectivity.

 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-01-2008, 07:54 PM
volmasoft volmasoft is offline
View Beta Profile
WHT Addict
 
Join Date: Mar 2004
Posts: 135
htaccess toughie

Hi guys,

Just to explain:
* I currently have http://www.site.com

* I can easily setup a redirect from http://site.com to http://www.site.com using:
Code:
RewriteCond %{HTTP_HOST} !^www\.site\.com$ [NC]
RewriteRule ^(.*)$ http://www.site.com/$1 [R=301,L]
* I use subdomain.site.com to link to certain dynamically created pages (index.php?site=subdomain

So using the above htaccess data will redirect everything to http://www.site.com, I only want it to direct http://site.com to http://www.site.com.

I've tried and tried but can't seem to get it to work I just get server errors.

So any help would be appreciated guys !

Cheers,
Nathaniel Freeman

__________________
My Blog - My Web Hosting, Programming, Computing and Univeristy blog

Reply With Quote
Sponsored Links
  #2  
Old 09-01-2008, 08:08 PM
foobic foobic is offline
View Beta Profile
Community Liaison
 
Join Date: Feb 2005
Location: Australia
Posts: 3,420
Code:
RewriteCond %{HTTP_HOST} ^site\.com$ [NC]
RewriteRule ^(.*)$ http://www.site.com/$1 [R=301,L]

__________________
Chris <ClonePanel>
"Not everything that can be counted counts, and not everything that counts can be counted" - Albert Einstein

Reply With Quote
  #3  
Old 09-01-2008, 08:10 PM
volmasoft volmasoft is offline
View Beta Profile
WHT Addict
 
Join Date: Mar 2004
Posts: 135
Ah okay, that's how. Cheers!

__________________
My Blog - My Web Hosting, Programming, Computing and Univeristy blog

Reply With Quote
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

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 On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement: