Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • I ISPConfig 3
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 550
    • Issues 550
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 41
    • Merge requests 41
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • ISPConfig
  • ISPConfig 3
  • Issues
  • #1602

Closed
Open
Created Oct 08, 2011 by Marcus@crazyiven

Rewrite Rule if Autosubdomain is *

If you create a Domain / Subdomain / Alias with Auto Subdomain "*" and use Rewrite Rules, the Condition only works for domain.tld, but not for www.domain.tld or test.domain.tld, because the Rewrite Rule uses ^domain.tld if you have no Auto Subdomain or * Subdomain. If you use "www" Auto Subdomain, it creates one Rule for ^domain.tld and one ^www.domain.tld and works fine for both.

If someone uses * Auto Subdomain, just use this RewriteCond/Rules to catch *.domain.tld and domain.tld for redirecting:

RewriteCond %{HTTP_HOST} ^([^.]+).domain.tld [NC] RewriteRule ^/(.*)$ TARGET [Flags]

RewriteCond %{HTTP_HOST} ^domain.tld [NC] RewriteRule ^/(.*)$ TARGET [Flags]

It took me long to see, that with Auto Subdomain * the subdomain www didn't redirect me cause of the rewrite rule and gone crazy, because without www (just domain.tld) the redirect worked fine :). Checked with auto subdomain www, and again worked for both, so i checked domain.vhost in /etc/apache2/sites-available/ and found the problem ;)

Assignee
Assign to
Time tracking