Brian
Brian

Reputation: 1896

URL rewrite - append subdomain for specific port

I'm trying to figure out the best way to use mod_rewrite to change a URL from:

http://localhost:8081

to:

http://localhost:8081/subdomain

I only want it to re-direct if it matches that specific port number.

Upvotes: 0

Views: 287

Answers (1)

sleeves
sleeves

Reputation: 536

How about this:

<VirtualHost *:8081>
    ServerName host.domain.com
    RewriteEngine     On
    RewriteRule       ^(.*)$        http://host.domain.com:8081/subdomain/$1  [P]
</VirtualHost>

Upvotes: 1

Related Questions