Solved

apache redirect and/or forwarding

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

820 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