Forum Moderators: phranque

Message Too Old, No Replies

mod rewrite - many subdomains to one?

but I need to keep track of where the user is coming from

         

mr_bungalow

4:43 pm on Feb 26, 2007 (gmt 0)

10+ Year Member



I've been trying to get this to work for the past two days and admit defeat.

We have a site where we need to keep track of where the user is coming from (i.e. www.site.com/entry1, www.site.com/entry2, www.site.com/entry3 which would redirect to www.site.com/home?cog=entry1¦entry2¦entry3).

We already have some mod_alias rules set up to point to the local directory. Is it possible to use mod_rewrite along with mod_alias?

Here are the two config files:

<IfModule mod_alias.c>
Alias /home "/home/foo/smart/static/"
</IfModule>

and here is where I am trying to redirect using mod_rewrite

RewriteEngine On
RewriteCond %{REQUEST_METHOD} TRACE
RewriteRule .* - [F]
RewriteRule ^/(entry1¦entry2¦entry3\.) /home [E=COG:$1]

This should in theory redirect to /home/foo/smart/static with an environment variable COG set to entry1, entry2, or entry3 right?

jdMorgan

11:06 pm on Feb 26, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What file is your mod_rewrite code in?

Why does entry3 (only) require a trailing period?

Jim

mr_bungalow

5:11 pm on Mar 7, 2007 (gmt 0)

10+ Year Member



I'm just learning this mod rewrite stuff but still can't get it working. I don't know why only entry3 has the trailing ./, it was just something I was messing with.

We are using Oracle Application Server, which is running apache on the back end. We have some dads set up on the back end that get redirected when the user hits the index.

What I am trying to do is keep track of where a user is coming from via the url and redirect everything to the same website. we have mod plsql running in the background serving out the web pages. so if the user comes to www.site.com/x or www.site.com/y or www.site.com/z they will get redirected to www.site.com/home?cog=x (or cog=y, cog=z).

If this something that is better suited to another tool than mod_rewrite?

Thanks in advance for any help!