Redirect URL , Mask address, eventually will need to apply SSL

daarchive
daarchive used Ask the Experts™
on
Hello All,

I am trying to do a redirect, which I have been able to do using the htaccess file, but I am having trouble meeting all of my requirements.

When users go to subdomain.domain.com, they need to be redirected to ip:8080/directory.

Address should be masked as subdomain.domain.com.

all directories for this site must be located using subdomain.domain.com/directories and there should be no imaging or access issues.

We will eventually need to add SSL to this, as it is a CRM site and the data needs to be protected.

Ive searched the net and found many articles where the code doesnt work.

Any help here is appriciated.

Thanks in advance.

-CH
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
do want to do this with PHP or with apache's mod_rewrite?

here is how mod_rewrite can do it:

RewriteEngine on
RewriteCond %{SERVER_PORT} !^8080$
RewriteCond %{HTTP_HOST} ^(subdomain.domain.com)$
RewriteRule (.*) http://ip/$1

what do you mean by?
  > Address should be masked as subdomain.domain.com.

Author

Commented:
I just mean i dont want the redirected address to show.

So a quick update. The redirect works, but I still see the address with the IP and not the subdomain.domain.com address.

Thanks for helping with this.
ok, that's what mod_proxy is for:

ProxyRequests Off
ProxyPass / http://ip/
ProxyPassReverse / http://ip/

this should be inside a <VirtualHost subdomain.domain.com> directive
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

Author

Commented:
Do I just add this to the currently working htaccess file? Say the bottom for example?

Author

Commented:
this should be inside a <VirtualHost subdomain.domain.com> directive

Also, what does this mean?
> .. currently working htaccess file?
no, it must be in apache's config file, i.e. httpd.conf

> Also, what does this mean?
you need to have a virtualhost section for your subdomain.domain.com
otherwise you cannot easily redirect the urls of just that subdomain
see http://httpd.apache.org/docs/2.4/vhosts/

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial