0

How would I exclude the a particular URL from rewrite condition when the REQUEST URI is not a folder or a file.

RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} !^(/users/|/products/|/webcall/)(.*)  
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]

/users and /products are real folders whereas/webcall is not a file/folder, but a controller action.

The above role seems to be working for /users and /products, but not for /webcall.

Basically I'm trying to redirect all requests to HTTPS except with the above patterns

  • What do you mean by "webcall not getting redirected"? Do you think it should redirect to https? – Amit Verma Feb 11 '16 at 06:03
  • Sorry, yes it should not be redirected. it was typo, will edit it. – Fahad Kilpady Feb 11 '16 at 06:12
  • Possible duplicate of [.htaccess mod\_rewrite - how to exclude directory from rewrite rule](http://stackoverflow.com/questions/1848500/htaccess-mod-rewrite-how-to-exclude-directory-from-rewrite-rule) – Bö macht Blau Feb 11 '16 at 06:52
  • `REQUEST_URI` only holds the URI path that was requested, it doesn't know or care how the value maps to the server's config or filesystem. So your RewriteCond should be fine. Can you give a sample URL for /webcall and one of the others. – Brandon Harris Feb 11 '16 at 06:53

0 Answers0