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!

2 Answers 2

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.

2
  • 1
    Thanks Max, we're unfortunately on shared hosting so have requested this info from the hosting provider.
    – Nick
    Commented Feb 21, 2014 at 10:53
  • 1
    Cheers, this fixed it!
    – Nick
    Commented Feb 21, 2014 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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