0

The first rule works fine when the maintenance file is in place. When it's not - the second rule is not redirecting to the specific URI. Is there an ordering issue of rules or ?

 #########################################

   RewriteCond %{DOCUMENT_ROOT}/server_maintenance.html -f
   RewriteCond %{REQUEST_FILENAME} !/server_maintenance.html
   RewriteRule ^.*$ /server_maintenance.html [L]

  #########################################
  ## the %{HTTP_HOST} evaluates to the HTTP header with the name given in this case host.server.org, with NC being non case sensitive.
  ## it will rewrite the url at the server side to append the URI of lawson/portal
  ##########################################################################
   RewriteCond %{HTTP_HOST} ^host\.server\.org$ [NC]
   RewriteRule ^host\.server\.org$ "https\:\/\/host\.server\.org\/lawson\/portal" [L]

  #########################################
Configueroa
  • 315
  • 4
  • 14

1 Answers1

0

You don't match a hostname in a RewriteRule, even so with more reason if you are already matching it in a previously defined RewriteCond.

So just do:

RewriteCond %{HTTP_HOST} ^host\.server\.org$ [NC]
RewriteRule ^ https://host.server.org/lawson/portal [L]

Note: RewriteRule target/destination is not regix so do not need to escape every single little thing.

Note2: a single ^ will match anything

Daniel Ferradal
  • 2,727
  • 1
  • 13
  • 19
  • using this method - I receive the following issue: You don't have permission to access / on this server. Directory index forbidden by Options directive: /lsf10/webdocs/ – Configueroa Apr 27 '17 at 18:14
  • how do you expect apache to serve a directory if you don't have indexes or a directoryindex set? – Daniel Ferradal Apr 27 '17 at 21:48