.htaccess Rewrite rules: what is the differences between %1 and $1 variables (percentage vs dollar sign)? [duplicate] .htaccess Rewrite rules: what is the differences between %1 and $1 variables (percentage vs dollar sign)? [duplicate] apache apache

.htaccess Rewrite rules: what is the differences between %1 and $1 variables (percentage vs dollar sign)? [duplicate]


You can use this in your .htaccess:

RewriteEngine OnRewriteCond %{HTTP_HOST} ^subdir\.example\.com$RewriteCond %{REQUEST_URI} !^/subdir/RewriteRule (.*) /subdir/$1

Make sure you clear your cache before testing it.

A suggested edit from OP:

RewriteEngine OnRewriteCond %{HTTP_HOST} ^(.*)\.example\.com$RewriteCond %{REQUEST_URI} !^/????/RewriteRule (.*) /????/$1