Knowledgebase

Subdomain htaccess redirect

Posted by ashras99, 01-30-2010, 12:58 AM
I like 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

Posted by Dr:linux, 01-30-2010, 03:41 AM
You can also access it through your cpanel server or plesk. Or get into your server in shell and use these commands # cd subdomain # vi .htaccess This allows you to redirect your subdomain into another URL: Paste the line below the configuration file of .htaccess >>>>>>>> Redirect 301 /subdomain to where to redirect (URL)<<<<<<<<< Feel free to get back to me if you need any further assistance...

Posted by ashras99, 01-30-2010, 04:47 AM
I know how to access htaccess... i am asking the code to write in htaccess but for subdomains code will be different... Redirect 301 subdomain.domain.com/profile.php?mode=register http://subdomain.domain.com/ucp.php?mode=register will not work for subdomains.

Posted by Dr:linux, 01-30-2010, 05:44 AM
Ok so its an URL that you want to redirect not folder... Anyways try using this. Paste this in your .htaccess configuration file. Redirect /link http://www.domainname.com If still facing doubts please go through this website. http://www.buildwebsite4u.com/advanc...ess-file.shtml Hope it works....

Posted by ashras99, 01-30-2010, 06:19 AM
i am talking about subdomain redirection and you are talking about useless things... i am using redirection from long time but dont know how to do with subdomain.

Posted by Dr:linux, 01-30-2010, 06:39 AM
I wonder why no one is replying or helping us to look forward this issue. # cd subdomain # vi .htaccess RewriteEngine on RewriteCond %{HTTP_HOST} ^subdomain.domain.com$ [OR] RewriteCond %{HTTP_HOST} ^www.subdomain.domain.com$ RewriteRule ^/?$ "http\:\/\/google\.com" [R=301,L] Just replace Google with your URL that you want to redirect.. Actually this thread had made my day....

Posted by ashras99, 01-30-2010, 06:42 AM
Have you tried this code before suggesting, because this also not work in context of the url i mentioned above.

Posted by Dr:linux, 01-30-2010, 08:17 AM
The above which I had mentioned worked fine on my custom subdomain. Are you using any forums like PHP,vBulletin etc.? Anyways please try this. All you have to do is to use the "Redirect" parameter in Apaches configuration file (httpd.conf).. That is Redirect permanent /profile.php http://subdomain.domain.com/ucp.php unless you have your POST/GET data follow with the redirect... Meanwhile let me know if any further assistance required..

Posted by ashras99, 01-30-2010, 08:29 AM
yes, i am using phpbb but that can be done through htaccess and not require to touch httpd.conf

Posted by Dr:linux, 02-02-2010, 08:20 AM
I hope by configuring .httpd file is the only way to fix this. >>>>If Mod_Rewrite is already enabled you can use the following code in the .htaccess. Put this in your .htaccess file which is in the main root of the subdomain Directory, RewriteEngine On RewriteRule ^(profile\.php\?mode=register) ucp.php?mode=register [R] After this Reload Apache. >>>>>> Or else, you need to enable Mod_rewrite using the following steps. Enable mod_rewrite from httpd.conf LoadModule rewrite_module modules/mod_rewrite.so Let me know the result. Thanks.



Was this answer helpful?

Add to Favourites Add to Favourites

Print this Article Print this Article

Also Read
Tax Implications (Views: 549)
Folder Syncing Windows (Views: 583)
AltusHost down!! (Views: 681)


Language:

Client Login

Email

Password

Remember Me

Search