code_junkie

.htaccess Redirections

Nov 12th, 2011
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. # If we're not on http://example.com
  2. RewriteCond %{HTTP_HOST} .+.example.com
  3.  
  4. # Add the host to the front of the URL and chain with the next rule
  5. RewriteRule ^(.*)$ ${HOST}$1 [C,QSA]
  6.  
  7. # Make the host a directory
  8. RewriteRule ^(.*).example.com(.*)$ http://example.com/$1$2 [QSA]
  9.  
  10. RewriteCond %{HTTP_HOST} ^([^.]+).example.com$
  11. RewriteRule ^ http://example.com/%1 [L,R]
  12.  
  13. RewriteCond %{HTTP_HOST} ^([^.]+).example.com$
  14. RewriteRule ^ /%1%{REQUEST_URI} [L]
Add Comment
Please, Sign In to add comment