Reputation:
How to redirect www.foo.com/bar to www.foo.com:8080 without "really" changing the url in the url bar?
So I want www.foo.com/bar (+ possible GET parameters / subfolders) to be shown always in the url bar.
Can this be done with mod_rewrite?
Upvotes: 2
Views: 5176
Reputation: 21
The reason for doing this is probably like my case. Home web server and the router blocks port 80 as its the fefault settings page for the router, so in order to run Xampp in my case i am using port 8080
Upvotes: 1
Reputation: 35117
No it cant. The :8080 tells the browser what port to connect to the server on. If it's not present it assumes the default for whatever protocol prefix you have (http = 80, https = 443, ftp = 21 etc.)
Upvotes: 2
Reputation: 655299
You need a proxy (mod_proxy) to do this. Here is an example with mod_rewrite’s RewriteRule
:
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^ http://%{HTTP_HOST}:8080%{REQUEST_URI} [P]
Upvotes: 5