apache mod_rewrite

Posted by eduard-schnittlauch on Server Fault See other posts from Server Fault or by eduard-schnittlauch
Published on 2010-01-16T16:02:59Z Indexed on 2010/04/10 8:03 UTC
Read the original article Hit count: 556

Filed under:
|

Hi,

I want mod_rewrite to do this:

http://server/* -> redirect to http://server/app/*
http://server/app/* should not be redirected

http://server.domain/* -> redirect to http://server/app/*
http://server.domain/app* -> redirect to http://server/app/*

It has to work with mod_jk!

Edit: this is the final solution

` force use of host 'server'
RewriteCond %{HTTP_HOST} !^server$
RewriteRule ^(.*)$ server$1 [R,NE,L]

` prepend /app to URL if missing
RewriteCond %{request_uri} !^/app.*?
RewriteRule ^(.+?)$ app/$1 [R,NE,L]

Thanks to you, fahadsadah and Insanity5902! I'm hesitant to flag either one of you as 'correct', as both have provided valuable input that made up the final solution.

© Server Fault or respective owner

Related posts about mod-rewrite

Related posts about apache