Forum Moderators: phranque

Message Too Old, No Replies

Help I am totally confused :)

         

RavenWulf

7:36 am on Jan 27, 2005 (gmt 0)



I am just now getting into htaccess, rewrite, etc and have no clue as to what I am really doing. To start learning this was prompted by a problem I am having.

I have a main domain (www.example.com) and have setup a redirect so that anyone going to the above address will be directed to www.example.com/catalog. It works wonderfully, however now I am having a problem getting to my 2 subdomains
www.forums.example.com
www.vendors.example.com

if you type in those addresses you just get sent to the www.example.com/catalog address.

Here is my current setup for my root htaccess file:

Redirect permanent /index.php [example.com...]

does anyone know what I can do so that people can get to my subdomains but still have people going to www.example.com go to the /catalog?

I am at a total loss for how to fix this.

Thank you all!
RW (Doug)

[edited by: jdMorgan at 8:10 pm (utc) on Jan. 27, 2005]
[edit reason] Removed specifics. Please see TOS. [/edit]

jdMorgan

8:19 pm on Jan 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Doug,

Welcome to WebmasterWorld!

Bad news/good news.

The bad news is that you can't fix this using mod_alias (The Redirect directive and others).

The good news is that you can fix it with mod_rewrite, if you are allowed to use it on your server.


Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)example\.com
RewriteRule ^index\.php$ http://www.example.com/catalog/index.php [R=301,L]

The RewriteCond restricts the rewrite so that it only occurs if the main domain or the "www" subdomain is requested.

See our forum charter [webmasterworld.com] for links to Regular Expressions and mod_rewrite documentation and tutorials.

Jim