Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need to redirect to folders from port 80 to 8080 1. Default index to /somename 2. /admin to /somename

I tried a .htaccess to

RewriteEngine on
Redirect / http://example.com:8080/somename
Redirect /admin http://example.com:8080/someAdmin

But i'm running JSP so the folder name i used is someAdmin (note A uppercase) It's impossible for me to change the path in my code (sorry about it)

Problem So because of this i'm getting error page (CASE sEnSiTive) redirection (Automatically it converts to small case in browser)

AddOn I'll be happy if it .htaccess could mask 8080 port from user via reverse proxy.

RewriteEngine on
RewriteCond  %{SERVER_PORT} !^8080$
RewriteRule ^(.*) http://%{SERVER_NAME}:8080/somefolder%{REQUEST_URI}
Redirect /admin http://%{SERVER_NAME}:8080/someAdmin
share|improve this question
    
What operating system? –  bahamat Aug 24 '11 at 23:33

1 Answer 1

up vote 1 down vote accepted

That's odd that Redirect is behaving like that. I don't have an Apache instance handy right now to verify that mod_alias is supposed to behave like that, but if it's not going to respect case in a target location, then I suppose just use mod_rewrite, since you're loading it anyway:

RewriteBase /
RewriteRule ^$ http://example.com:8080/somename [R,L]
RewriteRule ^admin$ http://example.com:8080/someAdmin [R,L]

For reverse proxying, it looks like you'd want to proxy instead of, as opposed to in addition to, the redirects?

For what you need, ProxyPass would work just fine, but it doesn't play nice with .htaccess. If you have the option, don't config this in .htaccess, use ProxyPass instead. If you don't, then mod_rewrite should do the trick:

RewriteBase /
RewriteRule ^admin(.*)$ http://example.com:8080/someAdmin$1 [R,L]
RewriteRule ^(.*)$ http://example.com:8080/somename/$1 [R,L]
share|improve this answer
    
Thanks @ShaneMadden the second one works great. :) –  mohan.hab Aug 26 '11 at 10:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.