Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

apache redirect and/or forwarding

Posted on 2014-03-20
4
Medium Priority
?
200 Views
Last Modified: 2014-08-15
what is the best way to forward all requests from port 80 to port 443 on an apache server (with tomcat behind it)?

my site basically gets accessed like this https://site.com/site
but i need to give users the ability to just type site.com or www.site.com and have it redirect to https://site.com/site

thanks
0
Comment
Question by:eli2011
4 Comments
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39943822
Here's what I was using.  Note that it forces Everything to HTTPS.
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^ https://www.site.com%{REQUEST_URI} [R=301]

RewriteCond %{HTTPS} !=on
RewriteRule ^ https://www.site.com%{REQUEST_URI} [L,R=301]

Open in new window

1
 
LVL 13

Expert Comment

by:Daniel Helgenberger
ID: 39944178
Another way would be the firewall, forward port 80 to 443. The advantage(?): does not enforce https and can be used from any to any port:
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 443

Open in new window

0
 
LVL 2

Accepted Solution

by:
Puspharaj Selvaraj earned 2000 total points
ID: 39944500
You can use Mod_jk for the redirection from apache to tomcat and vise-versa,

Mod_JK will cover the tomcat for security reason too.

If you need any confif help, just please come back here.
0
 
LVL 62

Expert Comment

by:gheist
ID: 39945040
<VirtualHost *:80>
  ServerAlias qwer.ty
  Redirect permanent / https://qwer.ty/ (probably temporary ipo permanent for testing)
</VirtualHost>
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month6 days, 22 hours left to enroll

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question