0

I want to use a custom page on 500 & 503 errorducument on IBM HTTP Server as well as shortener URL also using Rewrite that code for shorten URL (WCS).

Here are the rules I'm using:

RewriteCond  %{REQUEST_URI} /en/store(.*)

RewriteRule  ^/en/store(.*) $1 [R=301,L]

RewriteCond  %{REQUEST_URI} /((?!wcsstore/)(?!search/)(?!cont/)(?!cons/)(?!cs/)(?!wcs/)(?!cache/)(?!webapp/)(?!swagger/)(?!solr/))(.*) 

RewriteRule ^/((?!wcsstore/)(?!search/)(?!cont/)(?!cons/)(?!cs/)(?!wcs/)(?!cache/)(?!webapp/)(?!swagger/)(?!solr/))(.*) /webapp/wcs/stores/servlet/en/store/$2 [PT,L]

When I am not Using shorten URL code then ErrorDocument 500 /500.html Custom page is working fine. but when I am Using shorten URL code then ErrorDocument 500 /500.html Custom page is not working. And when I am using String like ErrorDocument 500 "Server in a problem so We will be back shortly" is working both condition, with shorten URL code or without shorten URL code.

lukkea
  • 3,606
  • 2
  • 37
  • 51
Test
  • 3
  • 5
  • Please add a question to your question. What do those rules have to do with the topic? – covener May 11 '17 at 15:02
  • I want to use a custom page on 500 & 503 errorducument on IBM HTTP Server as well as shortener URL also using Rewrite that code for shorten URL (WCS) – Test May 12 '17 at 05:26
  • When I am not Using shorten URL code then ErrorDocument 500 /500.html Custom page is working fine. but when I am Using shorten URL code then ErrorDocument 500 /500.html Custom page is not working. And when I am using String like ErrorDocument 500 "Server in a problem so We will be back shortly" is working both condition, with shorten URL code or without shorten URL code. – Test May 12 '17 at 06:48
  • formatted to code block and pulled OP's comments into question to help phrase a question. – lukkea May 19 '17 at 07:42

1 Answers1

0

Your final RewriteRule matches /500.html so it's rewritten. I'd suggest scrapping adding an additional RewriteCond that simply handles the error doc URL's, rather than adding more difficult to read negative lookaheads.

Note: the existing condition already looks redundant:

RewriteCond %{REQUEST_URI} /((?!wcsstore/)(?!search/)(?!cont/)(?!cons/)(?!cs/)(?!wcs/)(?!cache/)(?!webapp/)(?!swagger/)(?!solr/))(.*)
RewriteCond %{REQUET_URI} ^/\d\d\d.html
RewriteRule ^/((?!wcsstore/)(?!search/)(?!cont/)(?!cons/)(?!cs/)(?!wcs/)(?!cache/)(?!webapp/)(?!swagger/)(?!solr/))(.*) /webapp/wcs/stores/servlet/en/store/$2 [PT,L]
covener
  • 17,402
  • 2
  • 31
  • 45