Forum Moderators: phranque

Message Too Old, No Replies

Need to keep the filename and querystring

Rewrite to subdomain but *keeping* the filename and variables

         

helmet

5:33 pm on Mar 23, 2004 (gmt 0)

10+ Year Member




I have the following in the .htaccess in the my-domain.com/secure/ directory:

RewriteCond %{SERVER_PORT}!^443$
RewriteRule ^(.*) [secure.my-domain.com...] [R]

It is redirecting nicely to [secure.my-domain.com,...] but I want it to keep the filename and querystring...so:

[my-domain.com...]

should rewrite to:

[secure.my-domain.com...]

what am I missing?

jdMorgan

6:42 pm on Mar 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



helmet,

You are missing a back-reference to the 'filename'.


RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://secure.my-domain.com/[b]$1[/b] [R=301,L]

It may alo be necessary to take additional steps to forward the query string:

RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{QUERY_STRING} (.*)
RewriteRule (.*) https://secure.my-domain.com/$1[b]?%1[/b] [R=301,L]

I'd be interested to hear whether you need to use this second version.

Jim

helmet

6:52 pm on Mar 23, 2004 (gmt 0)

10+ Year Member



Thanks JD,
In my initial test it seems that everything after the last / is being passed with your first version.

helmet

7:48 pm on Mar 23, 2004 (gmt 0)

10+ Year Member



OK now I have another problem.

secure.my-domain.com is a subdomain in cpanel...

[secure.my-domain.com...] is pointing to my-domain.com/secure/

but...

[secure.my-domain.com...] is pointing to public_html

how can I fix it so accessing it on port 443 will also fetch files from the /secure/ directory?

Maybe I'm approaching this the wrong way...if I edit the ip:443 entry in httpd.conf to point to the subdirectory, I get a blank page...am I creating an endless loop? You can probably see what I'm trying to do...how should I be going about it?

Lost and thankful for your help,
Helmet.

jdMorgan

9:31 pm on Mar 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Calling all cPanel users...

helmet

4:44 am on Mar 24, 2004 (gmt 0)

10+ Year Member



Sorry, my fault...the problem was related to the global webroot and dirroot variables I set in my config.php file... they weren't working from the subdomain. Strangely I wasn't getting any errors printed in the browser.. had to check the log.