🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: demon.tech.unix
3 messages
3 total messages Started by Ian Tue, 03 Oct 2000 00:00
apache & mod_rewrite
#367
Author: Ian
Date: Tue, 03 Oct 2000 00:00
37 lines
1498 bytes
Help,

I've tried to get help regarding this problem in other n/gs, but to no
avail :-(.  Hopefully someone here will be able to help.... 

I'm having real problems trying to get my head round mod_rewrite.

I'm trying to achieve two things;


(1)
my web site can be accessed via several URL's, ie

www.examplesite.co.uk
www.example-site.co.uk
example-site.co.uk

etc..

I want these to be rewritten to one URL - www.examplesite.co.uk

I think I've achieved this by;

RewriteCond %{HTTP_HOST}	!www.examplesite.co.uk
RewriteRule ^.*$	http://%{SERVER_NAME}%{REQUEST_URI} [R]


(2)
Now - I wish to have all requests to  www.examplesite.co.uk/ go to my
normal document root, but www.examplesite.co.uk/any-other-text (where
'any-other-text', really is any text at all) redirected to
www.examplesite.co.uk/redirect.

Anything I write seems to put a browser in an endless loop, or try to
access www.examplesite.co.uk/any-other-text.

Any advice would be greatly appreciated.
Re: apache & mod_rewrite
#368
Author: David Coulson
Date: Tue, 03 Oct 2000 00:00
38 lines
1932 bytes
Ian wrote:

> I want these to be rewritten to one URL - www.examplesite.co.uk
> 
> I think I've achieved this by;
> 
> RewriteCond %{HTTP_HOST}        !www.examplesite.co.uk
> RewriteRule ^.*$        http://%{SERVER_NAME}%{REQUEST_URI} [R]

I'd personally use

RewriteRule (.*)	http://www.examplesite.co.uk/$1 [R,L]

because it'll then also track GET variables.

> (2)
> Now - I wish to have all requests to  www.examplesite.co.uk/ go to my
> normal document root, but www.examplesite.co.uk/any-other-text (where
> 'any-other-text', really is any text at all) redirected to
> www.examplesite.co.uk/redirect.
> 
> Anything I write seems to put a browser in an endless loop, or try to
> access www.examplesite.co.uk/any-other-text.

Heh, not asking much, are we?

RewriteRule /go		http://www.examplesite.co.uk/ [R,]
RewriteRule /redirect	http://www.examplesite.co.uk/ [R,L]
RewriteRule /(.+)	http://www.examplesite.co.uk/redirect [R]

Should work, although I've not tested it. IMHO, you really need to plan
what exactly you are trying to get your site to do, so you don't need
loads of messy rewrites all over the place (mod_rewrite ain't the
quickest thing on earth, y'know).

-- 
David Coulson
technoir@sourceforge.net
Re: apache & mod_rewrite
#286
Author: Ian
Date: Thu, 05 Oct 2000 00:00
11 lines
983 bytes
On Tue, 03 Oct 2000 20:41:27 +0100, David Coulson <technoir@linux.com>
wrote:

[snip]
>Should work, although I've not tested it. IMHO, you really need to plan
>what exactly you are trying to get your site to do, so you don't need
>loads of messy rewrites all over the place (mod_rewrite ain't the
>quickest thing on earth, y'know).

Thank you for your input.
I'll try this out in a couple of days.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads