Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a single domain. The main application serves from a single subdomain app.domain.com. I need a simple permenant redirect to redirect users that go to app.domain.com to be redirected to newapp.domain.com. This is so that the users can update the bookmarks. This is temporary and I would like it to be at the apache level (directory level) and do not want to do this via htaccess files; e.g. I want to make this change in httpd.conf.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Enable mod_rewrite, if it isn't. Then, in the config for the old domain:

RewriteEngine on
RewriteRule ^.*$ http://newapp.domain.com [R]
share|improve this answer
    
He has written that he don't want it via .htaccess –  Stony Mar 3 '11 at 21:05
    
@Stony Rewrite rules can be used in more places than just an .htaccess file. Per here: Context: server config, virtual host, directory, .htaccess –  Shane Madden Mar 3 '11 at 21:14
1  
Very important when you use this solution don't forget the return correct Statuscode 301 moved permanently or 307 Temporary Redirect. Its very important for Search Engines that he get the correct Statuscode. In This Solution in this Post [R=301,L] or [R=307,L] –  Stony Mar 3 '11 at 21:24
    
@Stony Good point, thanks! –  Shane Madden Mar 3 '11 at 21:27

You can try the apache2 module "mod_alias" with this you can make a permanent Redirect:

<VirtualHost *:80>
    ServerName: app.domain.com
    Redirect permanent / http://newapp.domain.com/
</VirtualHost>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.