How to Redirect a subdomain page to another page?

LinuxGuru
LinuxGuru used Ask the Experts™
on
I would like to redirect a following subdomain page to another page of the same domain.. please guide what will be the code...

URL - subdomain.domain.com/profile.php?mode=register

Redirect to - subdomain.domain.com/ucp.php?mode=register

Thanks.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
You can use the "Redirect" parameter in apache's config.  ie:

Redirect permanent /profile.php http://subdomain.domain.com/ucp.php

unless you have your POST/GET data follow with the redirect...
LinuxGuruLinux Server Administrator

Author

Commented:
Hello,

Thank you your reply. Is it possible to redirect using .htaccess?
Yes using the same thing you can in an htaccess file.

Pretty good explanation here: http://www.javascriptkit.com/howto/htaccess7.shtml
Monis MontherSystem Architect
Commented:
Why not use Mod_Rewrite

1- Enable mod_rewrite from httpd.conf

LoadModule rewrite_module modules/mod_rewrite.so

2- Put this in your .htaccess file which is in the main root of the subdomain Dir


RewriteEngine On

RewriteRule ^(profile\.php\?mode=register) ucp.php?mode=register [R]

3- Reload apache

/etc/init.d/httpd reload

Test

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