Url Redirect with Sub Domain Question

Using a single web hosting account to host multiple sites

Url Redirect with Sub Domain Question

Postby PixelFX » Tue Oct 02, 2007 1:41 pm

Hey there,
thanks so much for your help in the past.

I'm having a bit of brain fart here...

I have the code below which is working great

[code]
Options +FollowSymLinks
# Url to www.url Redirects
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www
RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [L,R]
[/code]

However I want to add a sub domain to the mix, with out it changing my subdomain abobe to a 400 error page.. because its redirecting the sub domain to something thats not there.

basically I have demo.url.com I want to add, and have it goto path.com/demo/ or demo/index.php etc

I've done all the vhost / paths etc, however if I turn the above code off it works but if I turn it on it makes it when I type demo.url.com into www.demo.url.com/demo

when I just want it to stay as demo.url.com/ or demo.url.com/index.php

and keep it so that if someone types url.com it auto forwards it to www.url.com as normal.

that make sence?

Any help would be greatly appeciated :D

Rob
PixelFX
 
Posts: 5
Joined: Fri Nov 10, 2006 2:18 pm

Postby richardk » Tue Oct 02, 2007 2:52 pm

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

# Only match domain.com
RewriteCond %{HTTP_HOST} ^(domain\.com)$ [NC]
RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby PixelFX » Tue Oct 02, 2007 10:03 pm

I see where I went wrong, I had both the old code and new code in there. IT works now :D

Thank you
Last edited by PixelFX on Thu Oct 04, 2007 5:01 pm, edited 1 time in total.
PixelFX
 
Posts: 5
Joined: Fri Nov 10, 2006 2:18 pm

Postby richardk » Wed Oct 03, 2007 1:57 pm

Try the mod_rewrite i provided again, but clear your browsers cache before going to demo.domain.com.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 4 guests

cron