masking subdomain - help if you can please

Using a single web hosting account to host multiple sites

masking subdomain - help if you can please

Postby dh10 » Tue Mar 27, 2007 8:43 am

Current Situation:

1. Currently I have a rewrite cond/rule that takes www.domain.com to domain.com
RewriteCond %{HTTP_HOST} !^domain\.com$ [NC]
RewriteRule .* http://domain.com/ [L,R=301]

2. Currently, via setup in cpanel, I have a subdomain subdomain.domain.com that correctly maps to domain.com/subdomain/

Here's what I want to do:

1. user types or clicks http://domain.com/subdomain/url.html and should see just http://subdomain/url.html in the browser. No redirect necessary.

Is my existing ReWrite rule conflicting with the masking I want? What masking code would you recommend?

Thanks much.
dh10
 
Posts: 2
Joined: Tue Mar 27, 2007 8:30 am

Postby richardk » Tue Mar 27, 2007 11:14 am

Maybe you want
Code: Select all
Options +FollowSymLinks

RewriteEngine On

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

Postby dh10 » Tue Mar 27, 2007 11:40 am

thanks. that looked like a lot safer way to strip the www off, and I've tested it and it works for that purpose.

However, it is not affecting how pages in the subdomain folder display. Individual pages still display with the full path off the main domain, whereas I want them to display simply as pages of the subdomain.

Do I now need to add a new .htaccess within the subdomain folder?

thanks!
dh10
 
Posts: 2
Joined: Tue Mar 27, 2007 8:30 am

Postby richardk » Tue Mar 27, 2007 11:48 am

You said you didn't want a redirect from the domain.com/subdomain to the sub domain.

Your links should reference the sub domain, not domain.com/subdomain. In the sub domain directory
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC]
RewriteRule ^(.*)$ http://sub.domain.com/$1 [R=301,L]
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 37 guests

cron