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 7164279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:02:57+00:00 2026-05-28T14:02:57+00:00

I’m currently trying to reconfigure a Apache server to be able to use another

  • 0

I’m currently trying to reconfigure a Apache server to be able to use another port than 80 when accessing a webpage, and then depending on what port a request was done I do some .htaccess magic. There is no problems with reconfiguring the Vhost and listen to any other port, but for some reason all non-ssl requests are always interpreted as coming to port 80.

If I try to open the page my.site.com:8080 my log shows something like this

my.site.com:80 my.ip. – – [23/Jan/2012:14:37:24 +0100] “GET
/images/pagenav_bg.gif HTTP/1.1” 200 2484
“http://my.site.com:8080/css/all.css” “Mozilla/5.0 (Windows NT 6.1;
WOW64; rv:8.0.1) Gecko/20100101 Firefox/8.0.1”

My .htaccessrules that have the condition “RewriteCond %{SERVER_PORT} ^80$” kicks in, and PHP $_SERVER[‘SERVER_PORT’]; shows port 80.

I’ve tried with different ports and I’ve even disabled listening on port 80, which gives the expected result that my.site.com stops working, but my.site.com:8080 still works.

So to be clear about the questing: How do I enable/reconfigure apache so that the “real” port number is used?

Edit: I just found out that this might have to do with mod_rewrite. But I haven’t found out how to circumvent it. I also find it a bit strange that .htaccess interpretates the port as 80 even before any rewrite rules run.

Edit2: After some more experimenting I’ve deducted that the problem is probably in my .htaccess file.
At the moment it looks like this

RewriteEngine On

#Rewrite rule to allow normal access to existing files
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]

#The normal rewriterule for the framework that is used
RewriteRule ^.*$ index.php [NC,L]

I believe the following is happening. When the rewrite is done it goes from http://my.site.com:8080/some/url to be interpreted as my.site.com/index.php by Apache, which by default is port 80. I must rewrite it to my.site.com:8080/index.php instead. The following snipped does not work however.

RewriteCond %{SERVER_PORT} ^8080$
RewriteRule ^(.*)$ http://my.site.com:%{SERVER_PORT}/index.php [NC,L]
  • 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-28T14:02:58+00:00Added an answer on May 28, 2026 at 2:02 pm

    I’ve found the answer and the redirects now work correctly. Unfortunately this means that I have to hard-code my redirects, but in this case it is acceptable.

    The problem was, as described in the edit to my question above, Apache and the .htaccess where my.site.com:8080/some/url was rewritten to my.site.com/index.php, and not my.site.com:8080/index.php.

    this was solved by adding one rule for each port where a specific case was needed such as

    RewriteCond %{SERVER_PORT} ^8080$
    RewriteRule ^(.*)$ http://my.other.site.com:%{SERVER_PORT}/index.php [NC,L]
    

    As seen in my edits in the original questions, this did not work at first, but that was only because my rules came in the wrong order. Problem solved.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I want use html5's new tag to play a wav file (currently only supported
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I used javascript for loading a picture on my website depending on which small
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

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.