troubleshooting Question

new .htaccess file - added new domain name to virtual hosting

Avatar of Trevor Local
Trevor Local asked on
Web DevelopmentApache Web Server
19 Comments1 Solution312 ViewsLast Modified:
Hello - I added a new domain to a virtual linux web host (Brinkster) and need to create an .htaccess file to redirect to it. I just wanted to make sure I have the proper code. Specifically, for my first domain do I put "public_html/" as the folder name or do I just leave that off?
Here's what I have:

#Turns the rewrite engine on.
RewriteEngine on

#Fix missing trailing slash character on folders.
RewriteRule ^([^.?]+[^.?/])$ $1/ [R,L]

#www.domain.com and domain.com will map to the folder {root}/folder1/
RewriteCond %{HTTP:Host} ^(?:www\.)?mynormaldomainname\.info$
RewriteCond %{REQUEST_URI} !^/public_html]/
RewriteRule ^(.*) folder1/$1 [NC,L,NS]

#www.otherdomain.com and otherdomain.com will map to the folder {root}/folder2/
RewriteCond %{HTTP:Host} ^(?:www\.)?mynewdomain\.com$
RewriteCond %{REQUEST_URI} !^/newdomainfolder/
RewriteRule ^(.*) folder2/$1 [NC,L,NS]

thanks in advance!
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 19 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 19 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros