Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6189729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:27:52+00:00 2026-05-24T02:27:52+00:00

I have an issue where we are running two systems on the same EC2

  • 0

I have an issue where we are running two systems on the same EC2 instances and using AWS Elastic Load Balancer to send request for one systems to port 81.

So for example we have http://www.example.com and bookings.example.com where the AWS Elastic Load Balancer sends requests for bookings. though to our EC2 boxes on port 80 and request for www. get sent though on port 81.

The customer connects to http://www.example.com on port 80 but then gets from the load balancer to the server on port 81.

When we add this rule for example to the .htaccess for the www site we have an issues with port 81 appearing.

RewriteRule ^index.html / [R=301,L,QSA] !-s
#Results in customer being sent to http://www.example.com:81/

How can I make sure the port 81 is not pushed back to the customer?

I have come up with this alternative:

RewriteRule ^index.html http://%{HTTP_HOST}/ [R=301,L,QSA] !-s

But in this example http is hard coded and I would need to make that variable so it can be https when needed. I also have more then just this index.html rule that redirect back to / I have about 30 rules and feel there should be a one liner to fix this passing port 81 back to the customer.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T02:27:52+00:00Added an answer on May 24, 2026 at 2:27 am

    Your alternative will work and could be extended for ssl support, but it’s probably not necessary. Apache follows a specific order when creating self referencing URL’s. UseCanonicalName, and UseCanonicalPhysicalPort control how they are created regardless of the module (mod_rewrite, mod_alias, etc).

    Without knowing more of your configuration, I would suggest starting with these directives in the appropriate VirtualHost.

    UseCanonicalName On
    ServerName www.example.com:80
    

    EDIT: If you don’t want to do this for whatever reason, here’s how you fix your rewrite to support ssl.

    RewriteCond %{HTTPS} =on
    RewriteRule - - [env=req_scheme=http,S=1]
    RewriteRule - - [env=req_scheme=https]
    
    RewriteRule ^index.html %{ENV:req_scheme}://%{HTTP_HOST}/ [R=301,L,QSA]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a simple Webapp running on two Tomcat instances behind Apache (a Tomcat
I am working on an application an have an issue about running shell command
We have an issue related to a Java application running under a (rather old)
I'm running into an issue where I have a FileUpload control in an UpdatePanel.
I have an issue that is driving me a bit nuts: Using a UserProfileManager
We have an issue using the PEAR libraries on Windows from PHP . Pear
I have an issue with using AWK to simply remove a field from a
I'm learning Java am having trouble running an example program. I have two files:
The set up I have websphere 6.1 running two application servers. Each running the
I have two versions of python installed on my mac running OSX Lion. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.