mod rewrite - Apache mod_rewrite, force https, forward from root folder -


i asked question yesterday still having trouble httpd.conf.

what happen this:

  • user requests http://www.mysite.com/ or mysite.com, etc. redirected https://www.mysite.com/shop/

  • i make sure request under /shop subdirectory rewritten https well, if user types in http://www.mysite.com/shop/help/ rewritten https://www.mysite.com/shop/help/

here configuration right now, 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 server receives request. example, redirect requests http host https server

<virtualhost *:80>     rewriteengine on     rewriterule .* https://%{http_host}/shop/ [r,l] </virtualhost> 

then try

<virtualhost *:80>     rewriteengine on     rewriterule ^/?shop/(.*) https://%{http_host}/shop/$1 [nc,r=301,l]     rewriterule ^/?$ https://%{http_host}/shop/ [r=301,l]      # other directives </virtualhost>  <virtualhost *:443>     rewriteengine on     rewriterule ^/?$ https://%{http_host}/shop/ [r=301,l]      # other directives </virtualhost> 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -