I want to load a private
site for an specific subdomain without creating a new virtual host (for not creating and repeating the virtual host configuration), in the following way:
mod_rewrite
appends /priv to the URL without redirection. Alias
directive gets /priv and loads /other_system_path/private private
page is loaded but the user sees no changes in the URL. My current config is as follows (inside the proper virtual host):
Alias /priv /other_system_path/private
RewriteEngine on
RewriteCond %{HTTP_HOST} ^priv\.mydomain\.com$
RewriteRule (.*) /priv [PT]
The PT
flag is, if I'm not wrong, for repeating the process of URL mapping, which turns into being got for the RewriteRule
again, since priv.
remains in the URL.
How can I achieve this?
The PT flag is, if I'm not wrong, for repeating the process of URL mapping, which turns into being got for the RewriteRule again, since priv. remains in the URL
You can skip the rule for the subrequests by adding the following condition
RewriteCond %{IS_SUBREQ} false
According to manual
IS_SUBREQ
Will contain the text "true" if the request currently being processed is a sub-request, "false" otherwise. Sub-requests may be generated by modules that need to resolve additional files or URIs in order to complete their tasks.
ps: and you need, as I think, RewriteRule ^/?(.*)$ /priv/$1 [PT]
, so that any request will be transformed to the correct one, not just to the 'root' of the alias.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.