php - htaccess redirect to a maintainance file -


i have htaccess in public directory:

<ifmodule mod_rewrite.c>     <ifmodule mod_negotiation.c>         options -multiviews     </ifmodule>      rewriteengine on      rewritebase /sub/web1/      # redirect trailing slashes...     rewriterule ^(.*)/$ /$1 [l,r=301]      # here need som magical oneliner redirect stuff maintenance.html     # no idea how write ;(      # handle front controller...     rewritecond %{request_filename} !-d     rewritecond %{request_filename} !-f     rewriterule ^ index.php [l] </ifmodule> 

and want add rule inside, when uncomment rule, links hit http://example.com/sub/web1/ or files down line, redirected http://example.com/sub/web1/maintenance.html

i have tried add: directoryindex maintenance.html redirects http://example.com/sub/web1/, if have subfolder or specific files http://example.com/sub/web1/posts, useless.

is there oneliner can pull domain name hasn't have typed absolutely? so, example.com - or whatever domain - not needed type in rule?

you can have rule this:

<ifmodule mod_rewrite.c>     <ifmodule mod_negotiation.c>         options -multiviews     </ifmodule>      rewriteengine on     rewritebase /sub/web1/      # uncomment line below route maintenance.html     # rewriterule !^maintenance\.html$ maintenance.html [l,nc]      # redirect trailing slashes...     rewriterule ^(.*)/$ /$1 [l,r=301]      # here need som magical oneliner redirect stuff maintenance.html     # no idea how write ;(      # handle front controller...     rewritecond %{request_filename} !-d     rewritecond %{request_filename} !-f     rewriterule ^ index.php [l] </ifmodule> 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -