3

I have the following htaccess setup:

<IfModule mod_rewrite.c>
        RewriteEngine On

        # force https for all URLs in /admin.php
        RewriteCond %{HTTPS} =off
        RewriteRule ^admin.php https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

        # Redirect index.php Requests
        # ------------------------------
        RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
        RewriteCond %{THE_REQUEST} !/system/.*
        RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,L]

        # Standard ExpressionEngine Rewrite
        # ------------------------------
        RewriteCond $1 !\.(css|js|gif|jpe?g|png) [NC]
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

This all works great, when a user goes to /admin.php they are forced to use https and when everywhere else they just use http. However if you navigate to a front end page using the https protocol you'll get a 404 error.

Seems to be because the index.php removal technique isn't working for https, for example:

https://domain.com/page - doesn't work https://domain.com/index.php/page - does work

http://domain.com/page - does work http://domain.com/index.php/page - does work

I can't work out what I need to change to make it work when in https as, as far as I can tell there isn't https/http specified in my htaccess for the index.php removal? Any ideas would be most appreciated!

4

Many default SSL setup have settings to ignore .htaccess at all. So server use your .htaccess for http, but for security reason ignore default rules overwrite for https.
Check your ssl config (try - /etc/httpd/conf.d/ssl.conf) what flag you have for AllowOverride? Possible you have None - in this case, the server will not even attempt to read .htaccess files in the filesystem. Change it to FileInfo.

| improve this answer | |
  • 1
    Thanks Max, we're unfortunately on shared hosting so have requested this info from the hosting provider. – Nick Feb 21 '14 at 10:53
  • 1
    Cheers, this fixed it! – Nick Feb 21 '14 at 11:48
2

Try this ::

1.) Go to your SSL configuration file : /etc/httpd/conf.d/ssl.con

2.) Find your Virtual Host : <VirtualHost_default_:443>

3.) Write down : Path to your directory

<Directory "/var/www/html/magento">
   AllowOverride All
</Directory>

4.) Restart your apache : service httpd restart

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.