wrap-per
wrap-per

Reputation:

How to redirect www.foo.com/bar to www.foo.com:8080 without changing url?

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

Answers (3)

LinuxLeprechaun
LinuxLeprechaun

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

Spencer Ruport
Spencer Ruport

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

Gumbo
Gumbo

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

Related Questions