[thelist] Mod Rewrite

RLivsey R.Livsey at cache-22.co.uk
Fri Aug 22 07:40:36 CDT 2003


Hi, I've never really used mod rewrite before and am getting a bit lost.

I am trying to rewrite the url so that if the user has come to the site 
not with a subdomain, then they should be directed to 
www.domain.com/mainsite/

IE

www.domain.com/123/456 -> www.domain.com/mainsite/123/456
domain.com/123/456 -> domain.com/mainsite/123/456

but the following would not be changed:

subdomain.domain.com/123/456

This is what I have got to so far:

#--- start .htaccess ---#
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.domain\.com$
RewriteRule ^www\.domain\.com/(.*) /mainsite/$1

RewriteCond %{HTTP_HOST} ^domain\.com$
RewriteRule ^domain\.com/(.*) /mainsite/$1
#--- end .htaccess ---#

But this isnt working (IE its doing nothing that I can tell).
mod_rewrite is definately in the loaded modules of Apache.

Any chance someone putting me on the right track?
It's fairly urgent as I need to get it working this afternoon.

Thanks.

-- 
R.Livsey
Incutio Web Developer
[ PHP | Perl | Java | C# ]
www.cache-22.co.uk
www.incutio.com



More information about the thelist mailing list