Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Apache and using a server alias - sort of working!

Status
Not open for further replies.
Dec 13, 2002
109
0
0
GB
I have a URL running through Apache as follows:

name>/welcome

I didn't want to reveal the <server name> in the url so had a DNS entry created called <new server name> that resolved to <server name>

Now I can access my URL as server name> and it takes me to the correct page. So far so good!

When I try to traverse further down the url by selecting a link - the served page "reverts" back to showing <server name> in the url, for example:

name>/welcome/next_page

instead of

server name>/welcome/next_page.

In my httpd.conf , under the <VirtualHost *:443> section I have:

ServerName <server name>
ServerAlias <new server name>

I guess I also need something else in order that the alias is displayed at all points?
 
You will probably also need to use mod_rewrite. You could add this to your virtualhost container or an .htaccess file in the root of your website. Something like:
Code:
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^new_server_name$ [NC]
RewriteRule (.*) [URL unfurl="true"]http://new_server_name/$1[/URL] [R=301,L]
 
And/Or make sure that ALL hrefs used on the site are root relative


In my httpd.conf , under the <VirtualHost *:443> section I have:
That will only affect https:// URLs as http:// URLs are Port 80.



Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top