If url ends with double dash, want to rewrite(Apache) -


if url ends double dash or hyphen(--), need redirect internal page.

rewriteengine on rewritecond %{request_uri} --$ rewriterule .* /error 

www.mysite.com/mypage-- www.mysite.com/error

but it's not working. there wrong code?

i think because deals special character not string.

*edit.

this whole vhost.conf.

servername mysite.com documentroot "/mywebroot/"  errordocument 400 /jsp/errorhandler.jsp errordocument 403 /jsp/errorhandler.jsp errordocument 404 /jsp/errorhandler.jsp errordocument 500 /jsp/errorhandler.jsp errordocument 503 /jsp/errorhandler.jsp  redirectmatch --$ /jsp/errorhandler.jsp   <ifmodule mod_jk.c>     jkmount /*.jsp          mysite     jkmount /*.do           mysite     jkmount /*.page         mysite     jkmount /*.json         mysite     jkmount /servlet/*      mysite </ifmodule>  <locationmatch "/servlet/*">     sethandler jakarta-servlet     setenv     jk_worker_name mysite </locationmatch>  <locationmatch "/*\.(do$|jsp$)">     sethandler jakarta-servlet     setenv     jk_worker_name mysite </locationmatch>      # begin expire headers     <ifmodule mod_expires.c>       expiresactive on       expiresbytype image/x-icon "access plus 2592000 seconds" ......      </ifmodule>     # end expire headers      # begin cache-control headers     <ifmodule mod_headers.c>        <locationmatch "\.(json)$">             header set cache-control "max-age=0, no-cache, no-store, must-revalidate"       </locationmatch>       <locationmatch "\.(do)$">             header set cache-control "max-age=8640000, public, must-revalidate"       </locationmatch>       <locationmatch "/*/header.jsp">             header set cache-control "max-age=0, no-cache, no-store, must-revalidate"       </locationmatch>     </ifmodule>     # end cache-control headers      <directory "/mywebroot/">             options -indexes followsymlinks multiviews             allowoverride none             order allow,deny             allow              deny env=go_out     </directory> 

this should work:

rewriteengine on rewriterule --$ /error 

if want actual redirect, use:

redirectmatch --$ /error 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -