Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Apache: Users

Question about redirects using RewriteMatch

 

 

Apache users RSS feed   Index | Next | Previous | View Threaded


ediego at exchange

Nov 19, 2009, 6:13 AM

Post #1 of 3 (419 views)
Permalink
Question about redirects using RewriteMatch

There are some sections of the site that I wanted to setup aliases for so when you browse to www.bus.miami.edu/businessmiami/, www.bus.miami.edu/inthenews/ and www.bus.miami.edu/embapr/ you automatically get redirected to the specified page.

RedirectMatch /businessmiami(/|$) "http://www.bus.miami.edu/news-and-media/publications/busmiami/index.html"
RedirectMatch /inthenews(/|$) "http://www.bus.miami.edu/news-and-media/in-the-news/index.html"
RedirectMatch /embapr(/|$) "http://www.bus.miami.edu/graduate-programs/executive-mba/emba-off-campus/puerto-rico/index.html"

I encountered a problem where I had an image in a folder /_assets/images/businessmiami/cover.jpg. The web page wouldn't load the image because the link was getting redirected because of the RedirectMatch. I'm not sure why it's not working correctly. Anyone have any suggestions.

Thanks,
Emil Diego


phil at philipwigg

Nov 19, 2009, 6:29 AM

Post #2 of 3 (389 views)
Permalink
Re: Question about redirects using RewriteMatch [In reply to]

2009/11/19 Diego, Emil <ediego [at] exchange>:
> There are some sections of the site that I wanted to setup aliases for so
> when you browse to www.bus.miami.edu/businessmiami/,
> www.bus.miami.edu/inthenews/ and www.bus.miami.edu/embapr/ you automatically
> get redirected to the specified page.
>
> RedirectMatch /businessmiami(/|$)
> "http://www.bus.miami.edu/news-and-media/publications/busmiami/index.html"
> RedirectMatch /inthenews(/|$)
> "http://www.bus.miami.edu/news-and-media/in-the-news/index.html"
> RedirectMatch /embapr(/|$)
> "http://www.bus.miami.edu/graduate-programs/executive-mba/emba-off-campus/puerto-rico/index.html"
>
> I encountered a problem where I had an image in a folder
> /_assets/images/businessmiami/cover.jpg.  The web page wouldn’t load the
> image because the link was getting redirected because of the RedirectMatch.
>  I’m not sure why it’s not working correctly.  Anyone have any suggestions.

I think a ^ at the beginning of your matching pattern should fix your
problem. For example:-

RedirectMatch ^/businessmiami(/*)$
"http://www.bus.miami.edu/news-and-media/publications/busmiami/index.html"

This means it only matches when /businessmiami is at the start of the
request URI and not in middle of it, as in your image link.

Cheers,
Phil.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe [at] httpd
" from the digest: users-digest-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd


tevans.uk at googlemail

Nov 19, 2009, 6:30 AM

Post #3 of 3 (389 views)
Permalink
Re: Question about redirects using RewriteMatch [In reply to]

On Thu, Nov 19, 2009 at 2:13 PM, Diego, Emil
<ediego [at] exchange>wrote:

> There are some sections of the site that I wanted to setup aliases for so
> when you browse to www.bus.miami.edu/businessmiami/,
> www.bus.miami.edu/inthenews/ and www.bus.miami.edu/embapr/ you
> automatically get redirected to the specified page.
>
> RedirectMatch /businessmiami(/|$) "
> http://www.bus.miami.edu/news-and-media/publications/busmiami/index.html"
> RedirectMatch /inthenews(/|$) "
> http://www.bus.miami.edu/news-and-media/in-the-news/index.html"
> RedirectMatch /embapr(/|$) "
> http://www.bus.miami.edu/graduate-programs/executive-mba/emba-off-campus/puerto-rico/index.html
> "
>
> I encountered a problem where I had an image in a folder
> /_assets/images/businessmiami/cover.jpg. The web page wouldn’t load the
> image because the link was getting redirected because of the RedirectMatch.
> I’m not sure why it’s not working correctly. Anyone have any suggestions.
>
> Thanks,
> Emil Diego
>

http://httpd.apache.org/docs/2.2/mod/mod_alias.html#redirectmatch

Your image matches the first regexp. If you mean "^/businessmiami(/|)$",
then you need to say so!

Cheers

Tom

Apache users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.