Advertisement

There's no such thing as a stupid question, but they're the easiest to answer.
Login
Search

Advertisement

Web Design & Development Web Design & Development
Search Search
Search for:
Tech Support Guy > > >

.htaccess - redirect to subfolder AND make "www" work


(!)

demonico's Avatar
demonico demonico is offline
Member with 2 posts.
THREAD STARTER
 
Join Date: Jul 2012
11-Jul-2012, 08:10 PM #1
Arrow .htaccess - redirect to subfolder AND make "www" work
I'm working with a client and an element of my htaccess file is simultaneously working and not working.

Here's the htaccess file as it stands now:

Code:
Options +FollowSymLinks
 
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} example1.com
RewriteCond %{HTTP_HOST} www.example1.com
RewriteCond %{REQUEST_URI} !EXAMPLE1/
RewriteRule ^(.*)$ EXAMPLE1/$1 [L]

RewriteCond %{HTTP_HOST} example2.org
RewriteCond %{HTTP_HOST} www.example2.org
RewriteCond %{REQUEST_URI} !EXAMPLE2/
RewriteRule ^(.*)$ EXAMPLE2/$1 [L]
This particular client has one hosting account with four websites hosted there in subfolders. I am trying to redirect traffic from example1.com to EXAMPLE1's subfolder (where it looks for index.html or whatever) while also allowing www vs. no-www to work in the domain bar.

The strange part... example1 is working, example2 is not. They're setup basically identically and I don't see a problem in the code. Example1 loads perfectly, Example2 loads a blank page. Help?
namenotfound's Avatar
Member with 3,009 posts.
 
Join Date: Apr 2005
Location: New York
12-Jul-2012, 02:08 AM #2
If you don't mind coding each redirect by hand, you could put this in a .htaccess file:

HTML Code:
Redirect 301 /site2 http://site2.domain.com/
So if someone goes go www.domain.com/site2/ it will redirect to site2.domain.com/

Is that kinda what you want?
demonico's Avatar
demonico demonico is offline
Member with 2 posts.
THREAD STARTER
 
Join Date: Jul 2012
12-Jul-2012, 03:37 AM #3
They are all separate domain names, all for separate companies. Be like for motherboard1, intel2, and videocard3.com - all as separate domain names, but under the same hosting account.
As Seen On

BBC, Reader's Digest, PC Magazine, Today Show, Money Magazine
WELCOME TO TECH SUPPORT GUY!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.


Tags
htaccess, no-www, redirect, www

(clock)
THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


WELCOME
You Are Using: Server ID
Trusted Website Back to the Top ↑