Solved

apache redirect and/or forwarding

Posted on 2014-03-20
4
187 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 82

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 500 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 61

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

To properly understand GitHub, let’s divide it into two words ‘Git’ and ‘Hub’. Git is basically a ‘Distribution Version Control’ (DVC) and ‘Source Code Management’ (SCM) system widely used by software programmers while Hub means the efficient centre…
Online collaboration is quickly becoming embedded in the workplace, and its benefits are tangible. See what the current landscape looks like and what the future holds for collaboration tools and the future of work.
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

759 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now