Forum Moderators: phranque
I need all requests for [subdomain.ortz.com...] to get permanently redirected to a page on the root domain (http://www.ortz.com/thepage.html).
I also need for the address bar in the browser to show [subdomain.ortz.com...] following the redirection.
Can somebody please show me what the .htaccess file on Apache should be to make this happen?
Also, will the .htaccess file have to go in the root or in the subdomain folder?
qqq
RewriteCond %{HTTP_HOST} ^subdomain_name\.
You can place the code in .htaccess in either the subfolder or in root *if* all subdomains resolve directly to root. Otherwise, the code will need to go into the subfolder, which will be less efficient. The pattern used in the RewriteRule will need to be adjusted to reflect the code's location.
Please see the references cited in our forum charter for more information, as well as our forum policies.
Jim
A redirect requires the cooperation of the client browser: The server sends a 301 or 302 response telling the browser to re-request the desired resource and gives it the new URL. The browser then must issue a new HTTP request using the new URL to get the relocated content.
A rewrite simply changes the "file" that a URL corresponds to. The client is unaware of this change.
Key in on those differences, and the examples will be more useful.
Jim