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
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
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
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.
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.
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.