Reputation: 67
Users on my site are creating their own pages, i want to make subdomain with redirect and masking real URL.
I have made RewriteRule:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(.+)\.domain\.com$
RewriteCond %1 !=www
RewriteRule ^(.*)$ http://domain.com/site.php?site=%1 [QSA,R=302]
When user enters:subdomain.domain.com
he will be trasfered to php script witch finds ID by page name in DB and redirects to:
domain.com/workarea/pages/ID/index.html
I wan't to mask real URL, just to show the URL with subdomain
subdomain.domain.com
but also i want to show all after /
when user go to gallery or smth else, like:
subdomain.domain.com/index.html
subdomain.domain.com/gallery.html
but i don`t know how to do that.
I've tried to use [P]
flag, but it just redirects to domain.com
,
or it is just don`t let the php script to work.
Please help me!
Upvotes: 1
Views: 459
Reputation: 6720
First off, even if set up to have htaccess redirect a subdomain to php; the following remark:
When user enters:subdomain.domain.com he will be trasfered to php script witch finds ID by page name in DB and redirects to: domain.com/workarea/pages/ID/index.html
Will ensure that your visitors will see domain.com/workarea/pages/ID/index.html
, because - as you say - php redirects visitors to that page. If you want to show the htaccess "masked" url, you need to make sure PHP parses the required HTML and not redirect.
As to the "masked" redirection from htaccess. What is the current behavior?
Upvotes: 2