I asked a question about this yesterday but I am still having trouble with my httpd.conf.
What I would like to happen is this:
-
User requests
http://www.mysite.com/ormysite.com, etc. They are then redirected tohttps://www.mysite.com/shop/ -
I would also like to make sure that any request under the
/shopsubdirectory is rewritten to HTTPS as well, even if the user types inhttp://www.mysite.com/shop/help/it would be rewritten ashttps://www.mysite.com/shop/help/
Here is my configuration right now, which isn’t working.
Listen *:443 https
Listen *:80 http
<VirtualHost *:80>
RewriteEngine on
ReWriteCond %{SERVER_PORT} !^443$
RewriteRule ^(shop/.*)$ https://%{HTTP_HOST}/shop/$1 [NC,R=301]
RewriteRule ^/$ https://%{HTTP_HOST}/shop/ [NC,R=301,L]
</VirtualHost>
<VirtualHost *:443>
SSLEngine On
SSLAppName QIBM_HTTP_SERVER_ZENDSVR
SetEnv HTTPS_PORT 443
RewriteEngine on
RewriteRule ^/$ https://%{HTTP_HOST}/shop/ [NC,R=301]
</VirtualHost>
First, make sure mod_rewrite kicks in when your server receives a request. For example, to redirect all requests from your HTTP host to your HTTPS server
Then try