Link to home
Start Free TrialLog in
Avatar of daarchive
daarchiveFlag for United States of America

asked on

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

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
Avatar of ahoffmann
ahoffmann
Flag of Germany image

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.
Avatar of daarchive

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of ahoffmann
ahoffmann
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Do I just add this to the currently working htaccess file? Say the bottom for example?
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/