Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Redirect Port with mod_rewrite |
|
Author |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7360 Location: Germany, Next to Hamburg
|
Posted: Fri 08 Jun '07 10:26 Post subject: Redirect Port with mod_rewrite |
|
|
This is how to redirect a whole domain, but not the folder "exception".
Code: |
RewriteRule ^/exception - [L]
RewriteRule ^/(.*) http://www.example.com:8080/$1
|
or
Code: |
RedirectMatch permanent ^/(?!exception/)(.*) http://www.example.de:8080/$1
|
more than one folder can be
Code: |
^/(?!exception/|otherfolder1/|otherfolder2/)(.*)
|
|
|
Back to top |
|
gcleaves
Joined: 01 Dec 2009 Posts: 14
|
Posted: Tue 01 Jun '10 9:47 Post subject: If using Zend Framework |
|
|
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.
Code: | 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 |
|
|
|
|
|
|