You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Mahmood Naderan <nt...@yahoo.com.INVALID> on 2018/09/05 06:09:37 UTC

[users@httpd] HTTPS and .htaccess

Hi




I have configured a Centos server with httpd for ssl support. Prior to that when I entered http://w.x.y.z I was able to see in the install page. After configuring ssl, I removed all files from /var/www/html and was able to see the test page when entering https://somewhere.com




Now when I put website files in /var/www/html and enter https://somewhere.com, I get this error



Not Found

The requested URL /install/install.php was not found on this server.



It seems that .htaccess file is incomplete for https access. However, I don't know what rules should I add. I also searched for similar things but didn't find a clear answer.

The content of the virtualhost is



[root@localhost html]# cat /etc/httpd/sites-available/moto.conf
<VirtualHost *:443>
    SSLEngine on
    SSLCertificateFile /home/snadmin/certi/certificate-standard_wildcard.somewhere.crt
    SSLCertificateKeyFile /home/snadmin/certi/certificate-standard_wildcard.somewhere.key
    SSLCertificateChainFile /home/snadmin/certi/intermediate.crt
    <Directory /var/www/html/>
    Options FollowSymLinks
    AllowOverride All
          Order allow,deny
          allow from all
          Require all granted
    </Directory>
    DocumentRoot /var/www/html/
    ServerName somewhere.com
</VirtualHost>



and the content of .htaccess is

Options +FollowSymLinks
RewriteEngine On

AddEncoding gzip .gz
AddEncoding gzip .gzip
<FilesMatch "\.(js.gz|js.gzip)$">
  ForceType text/javascript
</FilesMatch>
<FilesMatch "\.(css.gz|css.gzip)$">
  ForceType text/css
</FilesMatch>

<Files CHANGELOG.txt>
deny from all
</Files>
<Files INSTALL.txt>
deny from all
</Files>
<Files UPDATE.txt>
deny from all
</Files>


RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_URI} !/ow_updates/index\.php
RewriteCond %{REQUEST_URI} !/ow_updates/classes
RewriteCond %{REQUEST_URI} !/ow_cron/run\.php
RewriteCond %{REQUEST_URI} !/ow_cron/run\.php
RewriteCond %{REQUEST_URI} !/e500\.php
RewriteCond %{REQUEST_URI} !/captcha\.php
#RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.xml|\.feed|robots\.txt|\.raw|/[^.]*)$  [NC]
RewriteCond %{REQUEST_FILENAME} (/|\.php|\.html|\.htm|\.xml|\.feed|robots\.txt|\.raw|/[^.]*)$  [NC]
RewriteRule (.*) index.php






Any thought?


Regards,
Mahmood

Re: [users@httpd] HTTPS and .htaccess

Posted by Frank Gingras <th...@apache.org>.
You don't need to use .htaccess files, nor mod_rewrite. Run apachectl -S
and edit the appropriate vhost. Set the DocumentRoot and DirectoryIndex
properly, and also look into FallbackResource.

On Wed, Sep 5, 2018 at 2:09 AM Mahmood Naderan <nt...@yahoo.com.invalid>
wrote:

> Hi
>
>
> I have configured a Centos server with httpd for ssl support. Prior to
> that when I entered http://w.x.y.z I was able to see in the install page.
> After configuring ssl, I removed all files from /var/www/html and was
> able to see the test page when entering https://somewhere.com
>
>
> Now when I put website files in /var/www/html and enter
> https://somewhere.com, I get this error
>
>
> Not Found
> The requested URL /install/install.php was not found on this server.
>
>
> It seems that .htaccess file is incomplete for https access. However, I
> don't know what rules should I add. I also searched for similar things but
> didn't find a clear answer.
>
> The content of the virtualhost is
>
>
> [root@localhost html]# cat /etc/httpd/sites-available/moto.conf<VirtualHost *:443>
>     SSLEngine on
>     SSLCertificateFile /home/snadmin/certi/certificate-standard_wildcard.somewhere.crt
>     SSLCertificateKeyFile /home/snadmin/certi/certificate-standard_wildcard.somewhere.key
>     SSLCertificateChainFile /home/snadmin/certi/intermediate.crt
>     <Directory /var/www/html/>
>     Options FollowSymLinks
>     AllowOverride All
>           Order allow,deny
>           allow from all
>           Require all granted
>     </Directory>
>     DocumentRoot /var/www/html/
>     ServerName somewhere.com</VirtualHost>
>
>
> and the content of .htaccess is
>
>
> Options +FollowSymLinksRewriteEngine On
> AddEncoding gzip .gzAddEncoding gzip .gzip<FilesMatch "\.(js.gz|js.gzip)$">
>   ForceType text/javascript</FilesMatch><FilesMatch "\.(css.gz|css.gzip)$">
>   ForceType text/css</FilesMatch>
> <Files CHANGELOG.txt>
> deny from all</Files><Files INSTALL.txt>
> deny from all</Files><Files UPDATE.txt>
> deny from all</Files>
>
> RewriteCond %{REQUEST_URI} !^/index\.phpRewriteCond %{REQUEST_URI} !/ow_updates/index\.phpRewriteCond %{REQUEST_URI} !/ow_updates/classesRewriteCond %{REQUEST_URI} !/ow_cron/run\.phpRewriteCond %{REQUEST_URI} !/ow_cron/run\.phpRewriteCond %{REQUEST_URI} !/e500\.phpRewriteCond %{REQUEST_URI} !/captcha\.php#RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.xml|\.feed|robots\.txt|\.raw|/[^.]*)$  [NC]RewriteCond %{REQUEST_FILENAME} (/|\.php|\.html|\.htm|\.xml|\.feed|robots\.txt|\.raw|/[^.]*)$  [NC]RewriteRule (.*) index.php
>
>
>
> Any thought?
>
>
> Regards,
> Mahmood
>