Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

404 error with RewriteUrls enabled and SSL

Hello, I am adding SSL to my site and I found that there's something wrong with the redirection.

With RewriteUrls enabled in config, all pages return 404 error, only excluding home page. While the url with /index.php?p= works, no matter RewriteUrls enabled or disabled.

my .htaccess is

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php\?p=$1 [QSA,L]

So I am wondering what goes wrong here.

Comments

  • Options

    The redirection would work as long as I remove the SSL Virtual Host setting in Apache.
    So my virtual host site setting is like

    <VirtualHost *:80>
            ServerName example.com
            ServerAlias www.example.com
            Redirect permanent / https://www.example.com/
    </VirtualHost>
    
    <VirtualHost *:443>
            ServerName www.example.com
            SSLEngine on
            SSLCertificateFile /PATH_TO_CRT.crt
            SSLCertificateKeyFile /PATH_TO_CRT.key
            SSLCertificateChainFile /PATH_TO_CRT.crt
    
            ServerAdmin webmaster@localhost
            DocumentRoot /PATH
            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined
    </VirtualHost>
    
  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    It would be nice to get a link in order to give you a more conclusive answer, but if you don't mind a guess ,

    Does RewriteUrl work without SSL encryption ?

    https://wiki.apache.org/httpd/RewriteHTTPToHTTPS

    https://httpd.apache.org/docs/current/rewrite/flags.html

  • Options

    My bad, I forgot AllowOverride All

Sign In or Register to comment.