Can I do an if/then/else in htaccess?

后端 未结 5 811
名媛妹妹
名媛妹妹 2020-12-19 07:42

I have a site that serves up certain content based on the subdomain. So it is the same set of files, and maybe the header and some info in the site pages changes based on t

5条回答
  •  情深已故
    2020-12-19 08:06

    You can't use if/else because htaccess isn't a list of instructions. But, if you use a conditional block like or , you can use different directives based on which subdomain is being requested. I'm not sure which one you would use though...

    You could also put one .htaccess file one level above the files and use to specify different rules for each subdomain, but make the subdomain directories all be symlinks to the same directory with the shared files.

    so this would be the directory above the web root(s):
    .htaccess
    sitefiles
    subdomain1 (symlink to sitefiles)
    subdomain2 (symlink to sitefiles)
    ...

提交回复
热议问题