regex - How can I redirect all visitors to a subdirectory but still have access to the root directory for development -
i'm start building site , i've set "under construction" site @ http://positivechange.cl
i'd work directly on root directory during development don't have move files development subdirectory root directory, i'd redirect users http://positivechange.cl/maintenance
after searching online know how redirect subdirectory using redirectmatch ^/$ /subdirectory/
on .htaccess file, doesn't allow me access root directory , check how site going.
is there way this?
you can use code in document_root/.htaccess
file:
rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewritecond %{query_string} !(^|&)dev=1(&|$) [nc] rewriterule !^maintenance\.html$ maintenance.html [l,nc]
key use of query parameter dev=1
. without query parameter site show maintenance.html
. if add ?dev=1
url can access development website.
Comments
Post a Comment