views:

126

answers:

1

Am rather new to this world of htaccess redirects.Am trying to force all redirects in my Zend MVC to my https but I get a requested URL not found error on requests that dont go though the index controller

Example

https://www.example.com/auth/register

gives a requested URL /auth/register not found error. However if I remove the https redirect rule it works fine over http. If I adjust the URL to

https://www.example.com/index.php/auth/register

it works fine. The URL

https://www.example.com/index/faq 

works just fine since it goes through the index controller.

My .htaccess file looks like this

RewriteEngine On

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L]

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

<ifModule mod_gzip.c>
  mod_gzip_on Yes
  mod_gzip_dechunk Yes
  mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
  mod_gzip_item_include handler ^cgi-script$
  mod_gzip_item_include mime ^text/.*
  mod_gzip_item_include mime ^application/x-javascript.*
  mod_gzip_item_exclude mime ^image/.*
  mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>

What do I need to adjust to get the URL

https://www.example.com/auth/register

working?

A: 

Your code reads as "If this matches a file, link, or directory, then do nothing and continue." You need to skip the final rewrite rule in the case the file actually exists:

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [S=1,NC,L]
RewriteRule ^.*$ index.php [NC,L]
paulusdd
no change https://www.example.com/auth/register still bringing up the same error
davykiash