Jump to content

Htaccess Issue


Recommended Posts

I have http running fine and ssl enabled for managers , the script detects by login credentials,and it works fine.

My problem is I want when a manger turns on ssl(the URL is now https://site.com), they get redirected to https://www1.site.com.

How can I do this please, in .htaccess ?

I searched google extensively, before coming here, and cant find a solution.I dont want it to redirect http: to http://www1. just if ssl is enabled.

I also tried

RewriteCond %{SERVER_PORT} !^443$

RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

But it doesnt work.

Thank you

Link to post
Share on other sites

I have http running fine and ssl enabled for managers , the script detects by login credentials,and it works fine.

My problem is I want when a manger turns on ssl(the URL is now https://site.com), they get redirected to https://www1.site.com.

How can I do this please, in .htaccess ?

I searched google extensively, before coming here, and cant find a solution.I dont want it to redirect http: to http://www1. just if ssl is enabled.

I also tried

RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L][/code] But it doesnt work. Thank you I happen to have extensive Mod Rewrite knowledge... but I've never written a rule with a {SERVER_PORT} as a condition. First, try this...
[code]RewriteCond %{SERVER_PORT} ^443$
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]

With the "!" you're saying, 'if the request is NOT matching SERVER_PORT 443' -- you want 443 to be forwarded to https, right?

- CA3LE

Link to post
Share on other sites

I'm not sure about the port thing either , but Shouldn't this .........

RewriteCond %{SERVER_PORT} ^443$  RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
Look like this ..... ? or doesnt that matter
RewriteCond %{SERVER_PORT} ^443$  RewriteRule ^(.*)$ https://www1%{SERVER_NAME}%{REQUEST_URI} [L,R] 

And yes i would say you would have to see "www1" for sure for the redirect to be working. You are using www1 in your redirect yes ? I know dumb question , just the simple things sometimes you know.. And the 301 shouldnt matter since it wont be indexed anyhow

Link to post
Share on other sites

I'm not sure about the port thing either , but Shouldn't this .........

RewriteCond %{SERVER_PORT} ^443$  RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
Look like this ..... ? or doesnt that matter
RewriteCond %{SERVER_PORT} ^443$  RewriteRule ^(.*)$ https://www1%{SERVER_NAME}%{REQUEST_URI} [L,R] 

And yes i would say you would have to see "www1" for sure for the redirect to be working. You are using www1 in your redirect yes ? I know dumb question , just the simple things sometimes you know.. And the 301 shouldnt matter since it wont be indexed anyhow

THANKS FOR the help but it didn't work either.

I might be complicating the issue.I have a UCC ssl certificate,it has my domain name on it along with www1 and www2 .The cert is installed and everything is running ok, except for the issue of when ssl is on,the blue bar up top in my browser doesn't appear and stay.It only appears and stay when I do www1.domain.com or www2.domain.com .thus my trouble when the site is in normal ssl mode I want it to show up like https://www1.domain.com instead of https://domain.com

P.S the blue bar doesnt show when I type the site any other way, e.g https://www.domain.com ,https://domain.com

Link to post
Share on other sites

What I'm not understanding is how or why you'll carry the SSL from one domain to another, why not just skip the concern for SSL as a prerequisite , and redirect via simple link to the secured server ? No need for anything in .htaccess , yes ?

Either way , if they don't have the proper credentials , they cannot log in , right ? Just create a link stating ( whoever ) and point them to the www1.https://secured.domain .

There are many things you can do via .htaccess to prevent the running of malicious scripting and of known bad url , those silly brute force attempts ect. Even going further but password protecting a directory.

Link to post
Share on other sites
  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...