I wish to have request for http://user1.domain.com :
- return the output from http://www.domain.com/site-client/site.php?site=user1
- AND user still see the URL ‘http://user1.domain.com’ in the browser
Right now I have the following .htaccess:
RewriteEngine On
RewriteBase /
# Protect the htaccess file
<Files .htaccess>
Order Allow,Deny
Deny from all
</Files>
# Disable directory browsing
Options All -Indexes
RewriteCond %{HTTP_HOST} !^www.domain.com
RewriteCond %{HTTP_HOST} !^admin.domain.com
RewriteCond %{HTTP_HOST} ([^.]+).domain.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/site-client/site.php?site=%1 [L]
The successfully calls the http://www.domain.com/site-client/site.php?site=user1 URL, but it shows it to the user.
How can I avoid this?
You need to get rid of the
http://www.domain.compart of yorRewriteRule‘s target. It tells mod_rewrite that you want a 302 redirect. So your rule should look like this:EDIT: You’ll also need a check to keep the rule from looping