Solved

apache redirect and/or forwarding

Posted on 2014-03-20
4
196 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 83

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

2017 Webroot Threat Report

MSPs: Get the facts you need to protect your clients.
The 2017 Webroot Threat Report provides a uniquely insightful global view into the analysis and discoveries made by the Webroot® Threat Intelligence Platform to provide insights on key trends and risks as seen by our users.

Question has a verified solution.

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

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
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.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
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.
Suggested Courses

623 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