Direct subdomain to static link

Using a single web hosting account to host multiple sites

Direct subdomain to static link

Postby Sidewinder » Tue May 20, 2008 8:12 pm

Hello, I'm pretty new to this, and I have done a bit of searching. However, I'm am still having some difficulty figuring it out. I would like a (static) sub domain (silently) redirect to a static link.

http://sub.example.com -> http://www.example.com/forum/forumdisplay.php?f=3

The document root of sub.example.com is the document root of example.com.

I would appreciate your help.
Thank you,
John
Sidewinder
 
Posts: 5
Joined: Tue May 20, 2008 8:06 pm

Postby richardk » Thu May 22, 2008 1:57 pm

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

# Match the sub domain.
RewriteCond %{HTTP_HOST} ^sub\.example\.com$ [NC]
RewriteRule ^$ /forum/forumdisplay.php?f=3 [L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby Sidewinder » Sun May 25, 2008 10:48 am

Thank you, that partially works - but I think the rewrite rules in the /forum/ directory are interfering with it.

http://sub.example.com directs to http://www.example.com/forum/forumdisplay.php?f=3 which directs to http://sub.example.com/forum/forum-name/

Currently, I have a subdomain http://forum.example.com pointing to my forum directory (/public_html/forum/). The forum itself has its own rewrite rules to provide nice urls. http://forum.example.com/forumdisplay.php?f=3 directs to http://forum.example.com/forum-name/

Below is /public_html/forum/.htaccess
# Comment the following line (add '#' at the beginning)
# to disable mod_rewrite functions.
# Please note: you still need to disable the hack in
# the vBSEO control panel to stop url rewrites.
RewriteEngine On

# Some servers require the Rewritebase directive to be
# enabled (remove '#' at the beginning to activate)
# Please note: when enabled, you must include the path
# to your root vB folder (i.e. RewriteBase /forums)
#RewriteBase /
RewriteRule ^((urllist|sitemap).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]

RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} (admincp|modcp|clientscript|cpstyles|images)/
RewriteRule ^(.*)$ $1 [L]

RewriteCond %{QUERY_STRING} !vbseourl=
RewriteCond %{REQUEST_FILENAME} !chat
RewriteRule ^(.*\.php)$ vbseo.php?vbseourl=$1&%{QUERY_STRING} [L]

RewriteRule ^(archive/.*)$ vbseo.php?vbseourl=$1&%{QUERY_STRING} [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ vbseo.php?vbseourl=$1&%{QUERY_STRING} [L]


I would like to keep the above rules, but make http://sub.example.com direct to http://www.example.com/forum/forumdisplay.php?f=3 not http://sub.example.com/forum/forum-name/.

Thanks again!
Sidewinder
 
Posts: 5
Joined: Tue May 20, 2008 8:06 pm

Postby richardk » Sun May 25, 2008 11:05 am

Try adding
Code: Select all
RewriteCond %{HTTP_HOST} ^sub\.domain\.com$ [NC]
RewriteRule .* - [L]

after
Code: Select all
#RewriteBase /


Although i think the PHP is doing the redirect. If that is true mod_rewrite won't be able to stop it.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 2 guests

cron