I have an application based on Bonfire/Codeigniter, fully functional with no problems, accessing by HTTPS protocol.
But I have a folder named App , to access from outside bonfire, that only works with HTTP , if access it from HTTPS I receive an 404 error .
Bonfire Root
|_ application
|_ bonfire
|_ public
| |_ app <--I can access it only over HTTP, no HTTPS.
| |_ assets
| |_ ...
|_ tools
|_ index.php
Below is the file ssl.conf:
## ssl.conf ###
<VirtualHost *:443>
ServerName developer.mydomain.com
DocumentRoot /var/www/html/mycompany/bonfire-root/public
ServerAlias developer.mydomain.com
# Use separate log files for the SSL virtual host; note that LogLevel
ErrorLog logs/ssl_error_log_dev
TransferLog logs/ssl_access_log_dev
LogLevel warn
# SSL Engine Switch:
SSLEngine on
# List the protocol versions which clients are allowed to connect with.
SSLProtocol all -SSLv3
SSLProxyProtocol all -SSLv3
# User agents such as web browsers are not configured for the user's
SSLHonorCipherOrder on
# SSL Cipher Suite:
#SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM
#SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5
SSLCipherSuite HIGH:!aNULL:!MD5:!3DES:!CAMELLIA:!AES128
# Server Certificate and Keys:
SSLCertificateFile /etc/letsencrypt/live/***MY-DOMAIN***/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/***MY-DOMAIN***/privkey.pem
<IfModule mod_rewrite.c>
RewriteEngine On
# Enforce SSL https://www.
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(app\.php|assets|editor|css|js|scripts|templates|images|img|media|xml|user_guide|robots\.txt|favicon\.ico)
RewriteCond $1 !\.(css|js|jpe?g|gif|png|tiff|ttf|otf|woff|svg|mp3|mp4)$
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
Below is the file httpd.conf:
## httpd.conf ###
<VirtualHost *:80>
ServerName developer.mydomain.com
DocumentRoot /var/www/html/mycompany/bonfire-root/public
ServerAlias developer.mydomain.com
<Directory "/var/www/html/mycompany/developer">
Options Indexes FollowSymLinks MultiViews
Options +FollowSymlinks -Indexes
AllowOverride All
Require all granted
Options FollowSymLinks
AllowOverride All
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
Below is the file .htaccess:
## HTACCESS ##
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_URI} ^bonfire/codeigniter.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
</IfModule>
# Deny robots
<IfModule mod_rewrite.c>
RewriteCond %{HTTP_USER_AGENT} (googlebot|bingbot|Baiduspider|HTTrack) [NC]
RewriteRule .* - [R=403,L]
</IfModule>
# Checks to see if the user is attempting to access a valid file,
# such as an image or css document, if this isn't true it sends the
# request to index.php
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 index.php
</IfModule>
I'm already tried many options from otrhers like:
.htaccess mod_rewrite - how to exclude directory from rewrite rule
htaccess codeigniter mod-rewrite, rewritecond to ignore subdirectory within main app directory
My knowledge about this kind of config is very weak. Maybe someone can easily help :D
The main difference that I can see, is the absence of the DIRECTORY block in ssl.conf. Try copying it from the httpd.conf, or move it outside the VirtualHost.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.