GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   .htaccess Q -- redirect subdomain page to main domain page (https://gfy.com/showthread.php?t=952409)

gwidomains 02-06-2010 07:25 PM

.htaccess Q -- redirect subdomain page to main domain page
 
How do I use .htaccess 301 redirect to

Redirect a subdomain page to main domain page?

I have a bunch of pages on sub-domain page i need to redirect individually to different pages.

:helpme

spacedog 02-06-2010 07:40 PM

Code:

RewriteCond %{HTTP_HOST} !^sub\.domain\.com
RewriteRule (.*) http://domain.com/$1 [R=301,L]


gwidomains 02-06-2010 08:00 PM

Quote:

Originally Posted by spacedog (Post 16821362)
Code:

RewriteCond %{HTTP_HOST} !^sub\.domain\.com
RewriteRule (.*) http://domain.com/$1 [R=301,L]


i think that is for all pages on the sub domain though. I need to assign them individually... that's the problem :/

thx for the attempt though spacedog.

SmokeyTheBear 02-06-2010 08:32 PM

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.domain\.com
RewriteCond %{HTTP_HOST} ([^*]+)\.domain\.com [NC]
RewriteRule ^(.*)$ script.php?x=%1 [NC]

where %1 will be everything before .domain.com

so if its one.two.three.domain.com it will go to domain.com/script.php?x=one.two.three

fris 02-06-2010 09:00 PM

horrible examples :p

gwidomains 02-06-2010 09:03 PM

Quote:

Originally Posted by fris (Post 16821502)
horrible examples :p

:helpme:helpme:helpme


All times are GMT -7. The time now is 07:51 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123