views:

29

answers:

0

Hello everyone,

I want to redirect requested URLs that use subdomain such as anything.example.com to example.com, and I want the URL to remain anything.example.com.

Currently I am using:

ServerName www.example.com
ServerAlias *.example.com
RewriteRule ^/$ /homepage/ [P,L]

It works fine this way. But when I remove the flag P it stops working. I read the Apache documentation on RewriteRules but it didn't help me much. I would really appreciate an explanation for this.