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.
Look into either redirectmatch if no mod_rewrite or rewriterule with mod_redirect On 17 Aug 2010 18:14, "Craig White" <craigwhite at 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 at centos.org > http://lists.centos.org/mailman/listinfo/centos-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.centos.org/pipermail/centos/attachments/20100817/95cd4b36/attachment-0002.html>
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 at 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.
On Tuesday, August 17, 2010, Craig White <craigwhite at 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 > > CraigI 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."
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 subdirectoryRedirectMatch 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 at madboa.com <> http://www.madboa.com/
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 redirectedIf 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 at gmail.com