FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 08-17-2010, 05:28 PM
James Hogarth
 
Default apache rewrite

Look into either redirectmatch if no mod_rewrite or rewriterule with mod_redirect


On 17 Aug 2010 18:14, "Craig White" <craigwhite@azapple.com> wrote:> Is there some easy way to rewrite just the base URL to another URL but

> leave all other URL's unmolested?
>
> i.e.
>
> http://www.example.com = rewrite to another URL
>
> http://www.example.com/files = deliver from the assigned subdirectory

>
> obviously this...
> Redirect / http://www.other_url.com
> redirects everything
>
> and I don't want /files to be redirected
>
> Craig

>
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
> _______________________________________________

> CentOS mailing list
> CentOS@centos.org
> http://lists.centos.org/mailman/listinfo/centos


_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 08-17-2010, 05:38 PM
Craig White
 
Default apache rewrite

On Tue, 2010-08-17 at 18:28 +0100, James Hogarth wrote:
> Look into either redirectmatch if no mod_rewrite or rewriterule with
> mod_redirect
>
> On 17 Aug 2010 18:14, "Craig White" <craigwhite@azapple.com> wrote:
> > Is there some easy way to rewrite just the base URL to another URL
> but
> > leave all other URL's unmolested?
> >
> > i.e.
> >
> > http://www.example.com = rewrite to another URL
> >
> > http://www.example.com/files = deliver from the assigned
> subdirectory
> >
> > obviously this...
> > Redirect / http://www.other_url.com
> > redirects everything
> >
> > and I don't want /files to be redirected
> >
----
ahh - indeed, so many pages and looked at all of the examples but it was
actually easy...

RedirectMatch ^/$ http://example.com

(the use of Match for regex and ^/$ was the key)

Thanks

Craig


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 08-17-2010, 05:41 PM
Alan Hodgson
 
Default apache rewrite

On Tuesday, August 17, 2010, Craig White <craigwhite@azapple.com> wrote:
> Is there some easy way to rewrite just the base URL to another URL but
> leave all other URL's unmolested?
>
> i.e.
>
> http://www.example.com = rewrite to another URL
>
> http://www.example.com/files = deliver from the assigned subdirectory
>
> obviously this...
> Redirect / http://www.other_url.com
> redirects everything
>
> and I don't want /files to be redirected
>
> Craig

I think matching on ^/$ with mod_rewrite will do what you want.

--
"No animals were harmed in the recording of this episode. We tried but that
damn monkey was just too fast."
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 08-17-2010, 05:48 PM
Paul Heinlein
 
Default apache rewrite

On Tue, 17 Aug 2010, Craig White wrote:

> Is there some easy way to rewrite just the base URL to another URL but
> leave all other URL's unmolested?
>
> i.e.
>
> http://www.example.com = rewrite to another URL
>
> http://www.example.com/files = deliver from the assigned subdirectory

RedirectMatch permanent '^/[/]*$' http://your.other/url/

The more typical regex is '^/$', but I've found that matching
otherwise meaningless trailing slashes isn't a bad idea.

--
Paul Heinlein <> heinlein@madboa.com <> http://www.madboa.com/
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 08-17-2010, 05:50 PM
Les Mikesell
 
Default apache rewrite

On 8/17/2010 12:14 PM, Craig White wrote:
> Is there some easy way to rewrite just the base URL to another URL but
> leave all other URL's unmolested?
>
> i.e.
>
> http://www.example.com = rewrite to another URL
>
> http://www.example.com/files = deliver from the assigned subdirectory
>
> obviously this...
> Redirect / http://www.other_url.com
> redirects everything
>
> and I don't want /files to be redirected


If you are using RewriteRules, you can use the [PT,L] flags to force
matches to be handled immediately without changes or checking for
additional matches, so:
RewriteRule ^/files - [PT,L]
would make everything under /files be handled from the original location
regardless of subsequent rewrites. ^/* would probably work too.

Then you can use
RewriteRule ^/$ http://www.other_url.com [R,L]
for the redirect. This approach makes it fairly easy to mix and match
content from old/new locations during a transition. Or you can proxy
some pages with the P flag if you don't want to expose the new location.

--
Les Mikesell
lesmikesell@gmail.com

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 06:39 AM.

VBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org