I have a url that looks like this: www.example.com/folder. Now, I was wondering how I can tell Apache to redirect the url to folder.example.com
Asked
Active
Viewed 193 times
-1
-
http://httpd.apache.org/docs/current/mod/mod_rewrite.html – quanta Oct 16 '11 at 07:19
-
@quanta Okay thanks. But maybe the word I should have used was Redirect – burntblark Oct 16 '11 at 07:22
1 Answers
3
The simplest solution is to place a single .htaccess
file inside your /folder
directory:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.example\.com [NC]
RewriteRule (.*) http://folder.example.com/$1 [R=301,L]
</IfModule>
Please note, that your Apache needs to be configured with mod_rewrite

mate64
- 1,681
- 4
- 18
- 29