Apache Lounge



Forum Index Downloads Search Register Log in  RSS Apache Lounge

Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.



A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Apache Lounge is not sponsored.

Your donations will help to keep this site alive and well, and continuing building binaries.

Redirect Port with mod_rewrite

Post new topic   Reply to topic    Apache Forum Index -> How-to's & Documentation & Tips

View previous topic :: View next topic  
Author Message
James Blond

Joined: 19 Jan 2006
Posts: 6570
Location: Germany, Next to Hamburg

PostPosted: Fri 08 Jun '07 10:26    Post subject: Redirect Port with mod_rewrite Reply with quote

This is how to redirect a whole domain, but not the folder "exception".


RewriteRule ^/exception - [L]
RewriteRule ^/(.*) http://www.example.com:8080/$1



RedirectMatch permanent ^/(?!exception/)(.*) http://www.example.de:8080/$1

more than one folder can be


Back to top

Joined: 01 Dec 2009
Posts: 14

PostPosted: Tue 01 Jun '10 9:47    Post subject: If using Zend Framework Reply with quote

This is what I do to redirect my site that uses Zend Framework to port 8080. Seems to work but I'm no expert. First I check that the port is NOT 8080 and redirect to 8080. Then I ensure that the port IS 8080 and do the redirection that is necessary for the Zend Framework to work. I give this last redirection the L switch, meaning stop processing.

RewriteEngine on
RewriteCond  %{SERVER_PORT} !^8080$
RewriteRule ^(.*) http://%{SERVER_NAME}:8080%{REQUEST_URI}

RewriteCond  %{SERVER_PORT} ^8080$
#ZF portion below
RewriteRule .* index.php [L]
Back to top

Post new topic   Reply to topic    Apache Forum Index -> How-to's & Documentation & Tips
Page 1 of 1