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
PHP

Avatar of undefined
Last Comment
ahoffmann
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
daarchive
Flag of United States of America image

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

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of daarchive
daarchive
Flag of United States of America image

ASKER

Do I just add this to the currently working htaccess file? Say the bottom for example?
Avatar of daarchive
daarchive
Flag of United States of America image

ASKER

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

Also, what does this mean?
Avatar of ahoffmann
ahoffmann
Flag of Germany image

> .. 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/
PHP
PHP

PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.

125K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo