Jump to content


- - - - -

Htaccess Issue


  • You cannot reply to this topic
6 replies to this topic

#1 STAINLESS

    Earning Trust

  • Members
  • Pip
  • 3 posts

Posted 31 December 2010 - 12:03 AM

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

#2 CA3LE

    TestMy.net Webmaster

  • Administrator
  • 6,766 posts
  • Location: 00110110 00110000 00110010

Posted 31 December 2010 - 02:46 AM

View PostSTAINLESS, on 31 December 2010 - 12:03 AM, said:

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

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...

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
"Working to improve our Internet one connection at a time."
Posted Image

#3 STAINLESS

    Earning Trust

  • Members
  • Pip
  • 3 posts

Posted 31 December 2010 - 04:13 AM

Thank you for answering.I actually tried that which you gave, but it still did not work.Or maybe it is working and I am not explaining myself.When accessing https, it shows in the browser https://site.com , I want the browser to be changed to https://www1.site.com, I should see it changed in the browser right?

#4 mudmanc4

    TMN Seasoned Veteran

  • Moderators
  • 9,040 posts
  • Location: In The Plex

Posted 31 December 2010 - 09:13 AM

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
Vote 2012 !
Posted Image Posted Image

So how's everybody doing in that little head of yours ? ™

#5 STAINLESS

    Earning Trust

  • Members
  • Pip
  • 3 posts

Posted 03 January 2011 - 01:37 AM

View Postmudmanc4, on 31 December 2010 - 09:13 AM, said:

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

#6 mudmanc4

    TMN Seasoned Veteran

  • Moderators
  • 9,040 posts
  • Location: In The Plex

Posted 03 January 2011 - 04:05 PM


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.


Vote 2012 !
Posted Image Posted Image

So how's everybody doing in that little head of yours ? ™

#7 dainius

    Earning Trust

  • Members
  • Pip
  • 1 posts

Posted 23 January 2011 - 04:45 AM

I need a program that can speed up my internet speed internet speed is only 28.8 - 56 kbps Please help me :rolleyes: :rolleyes: :rolleyes: :rolleyes: :rolleyes: :rolleyes:





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users