Skip to content

Instantly share code, notes, and snippets.

@ali5h
Created May 18, 2015 20:36
Show Gist options
  • Save ali5h/9f70bd6f18bb61aa9cda to your computer and use it in GitHub Desktop.
Save ali5h/9f70bd6f18bb61aa9cda to your computer and use it in GitHub Desktop.
Apache redirect rule: form an url path to subdomain
# Redirect /path to sub.
RewriteEngine on
RewriteCond %{REQUEST_URI} =/path [NC]
RewriteCond %{HTTPS}s ^on(s)|off
RewriteCond http%1://%{HTTP_HOST} ^(https?://)(www\.)?(.+)$
RewriteRule ^ %1sub.%3 [R=301,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment