Search code examples
phpregex.htaccessmod-rewritemod-proxy

Using mod_proxy to re-direct to a https sub-domain?


This is something I've asked previously, with a suggested solution of using mod_proxy, but unfortunately even with that I cannot get this working :(

I want to re-direct from a regular link to a https sub-domain so for example https://photofileltd.co.uk/index.php?page=services would then display https://secure.photofileltd.co.uk/new_site/index.php?page=services - but retain the URL!

Here's my .htaccess file, I've added the 'P' to load the proxy thing, but I just get a 500 internal server error:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://secure.photofileltd.co.uk/new_site/$1 [L, P]

Any help or advice would be much appreciated, thank you


Solution

  • You would have to contact the web host if you can't find the log files, to find out where they keep them.

    However, I will say that you shouldn't need mod_proxy, I think what you want to do is this:

    # Set options
    Options +FollowSymLinks -MultiViews
    
    # Redirect insecure requests to HTTPS
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://secure.photofileltd.co.uk/new_site/$1 [L,QSA,R=301]