You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Ian <ia...@canvey.com> on 2002/08/03 17:54:20 UTC

Redirecting confusion :(

Hi,

Can someone kindly point me in the right direction to improve the way
that I am redirecting users?

I currently use the following in .htaccess

Redirect permanent  /dir/group1
http://www.domain.net/dir/forums.php?Cat=1,39,126,129,130
Redirect permanent  /dir/group2
http://www.domain.net/dir/forums.php?Cat=1,34,110,129,130
Redirect permanent  /dir/group3
http://www.domain.net/dir/forums.php?Cat=1,3,128,129,130

Now whilst this works - I could potentially have a few hundred of these
in the .htaccess file. The other problem is that if anyone puts
http://www.domain.net/dir/group1/ in their browser the user gets an
error :( The same /dir/ physically exists on both sides, whilst the
group1, group2 etc., do not physically exist.

The reason why I need this is that the resulting URL alters (the digits
change) on a fairly frequent basis.

Question - can I improve the way that I do this to -  eliminate the
error if they put a / after the URL

And if possible to mask the eventual URL so that users do not bookmark
it - probably impossible :)

Maybe I am doing everything correctly, but I have a feeling that I am
not. My concerns come when it grows from say 40 redirects at the moment
to say 3 or 400 in a years time. I have read through various documents
and got myself totally confused!

Regards,

Ian



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: Redirecting confusion :(

Posted by Robert Andersson <ro...@profundis.nu>.
Ian wrote:
> > AliasMatch ^/dir/group3/?$ /dir/forums.php?Cat=1,3,128,129,130
> > (or something similar)
> >
> Thank you for this.
>
> So if AliasMatch is the best option, would it be better to have 2 or 3
> hundred of these in the root .htaccess of the site or in the conf file?

Probably better (faster) to have them in the conf, so it doesn't have to
parse a huge .htaccess file on every access. I would probably put them in a
separate file, and include that file into the main config.

Regards,
Robert Andersson


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: Redirecting confusion :(

Posted by Ian <ia...@canvey.com>.
> Robert wrote:
> 
> 
> Ian wrote:
> > Hi,
> >
> > Can someone kindly point me in the right direction to 
> improve the way 
> > that I am redirecting users?
> >
> > I currently use the following in .htaccess
> >
> > Redirect permanent  /dir/group1 
> > http://www.domain.net/dir/forums.php?Cat=1,39,126,129,130
> > Redirect permanent  /dir/group2 
> > http://www.domain.net/dir/forums.php?Cat=1,34,110,129,130
> > Redirect permanent  /dir/group3 
> > http://www.domain.net/dir/forums.php?Cat=1,3,128,129,130
> >
> > Now whilst this works - I could potentially have a few hundred of 
> > these in the .htaccess file. The other problem is that if 
> anyone puts 
> > http://www.domain.net/dir/group1/ in their browser the user gets an 
> > error :( The same /dir/ physically exists on both sides, whilst the 
> > group1, group2 etc., do not physically exist.
> >
> > The reason why I need this is that the resulting URL alters (the 
> > digits
> > change) on a fairly frequent basis.
> >
> > Question - can I improve the way that I do this to -  eliminate the 
> > error if they put a / after the URL
> >
> > And if possible to mask the eventual URL so that users do 
> not bookmark 
> > it - probably impossible :)
> 
> Then, I believe, you should use Alias or AliasMatch instead.
> 
> The slash thing should be avoidable if you in the matching 
> part puts a trailing slash, or if you use AliasMatch you can 
> make that optional, such
> as:
> AliasMatch ^/dir/group3/?$ /dir/forums.php?Cat=1,3,128,129,130
> (or something similar)
> 
Thank you for this.

So if AliasMatch is the best option, would it be better to have 2 or 3
hundred of these in the root .htaccess of the site or in the conf file?

Thanks for the help.

Ian



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: Redirecting confusion :(

Posted by Robert Andersson <ro...@profundis.nu>.
Ian wrote:
> Hi,
>
> Can someone kindly point me in the right direction to improve the way
> that I am redirecting users?
>
> I currently use the following in .htaccess
>
> Redirect permanent  /dir/group1
> http://www.domain.net/dir/forums.php?Cat=1,39,126,129,130
> Redirect permanent  /dir/group2
> http://www.domain.net/dir/forums.php?Cat=1,34,110,129,130
> Redirect permanent  /dir/group3
> http://www.domain.net/dir/forums.php?Cat=1,3,128,129,130
>
> Now whilst this works - I could potentially have a few hundred of these
> in the .htaccess file. The other problem is that if anyone puts
> http://www.domain.net/dir/group1/ in their browser the user gets an
> error :( The same /dir/ physically exists on both sides, whilst the
> group1, group2 etc., do not physically exist.
>
> The reason why I need this is that the resulting URL alters (the digits
> change) on a fairly frequent basis.
>
> Question - can I improve the way that I do this to -  eliminate the
> error if they put a / after the URL
>
> And if possible to mask the eventual URL so that users do not bookmark
> it - probably impossible :)

Then, I believe, you should use Alias or AliasMatch instead.

The slash thing should be avoidable if you in the matching part puts a
trailing slash, or if you use AliasMatch you can make that optional, such
as:
AliasMatch ^/dir/group3/?$ /dir/forums.php?Cat=1,3,128,129,130
(or something similar)

Regards,
Robert Andersson


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org