icon Get the most out of Surmunity, read our tips here! Need an interesting blog to read? You've got to read the Surpass Blog! | Welcome! Please register to access all of our features.

» Surpass Web Hosting Forums » Discussions » Private Hosting » htaccess help

Private Hosting Questions about VPS, dedicated servers and colocation.

Reply
 
LinkBack Thread Tools Search this Thread
Old September 18th, 2007, 11:13 PM   #1 (permalink)
Registered User
Fresh Surpasser
 
Joined in Aug 2005
12 posts
Gave thanks: 2
Thanked 0 times
htaccess help

I have tried to figure this out, but can't seem to get it.

I'm redirecting my top level (www.hotcouponwworld.com) to www.hotcouponworld.com/forums

I have added a store sub-domain (stores.hotcouponworld.com), but when I got to it I get redirected back to the forums.

Code:
#RewriteBase /

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^stores/?$ http://stores.hotcouponworld.com/index.php [R=301,L]

RewriteCond %{HTTP_HOST} !^www\.hotcouponworld\.com
RewriteRule (.*) http://www.hotcouponworld.com/forums/$1 [L,R=301]
I know I have done this wrong. Any help is appreciated.

Mark
__________________
My site is:
www.hotcouponworld.com
markp_2000 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old September 19th, 2007, 11:06 AM   #2 (permalink)
Registered User
Comfy Contributor
 
nathon's Avatar
 
Joined in Sep 2007
Lives in ~root
111 posts
Gave thanks: 1
Thanked 12 times
mod_rewrite

Try turning off mod_rewrite through the htaccess in the subdomains

Just use

Rewriteengine Off
nathon is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old September 20th, 2007, 12:10 AM   #3 (permalink)
Registered User
Fresh Surpasser
 
Joined in Aug 2005
12 posts
Gave thanks: 2
Thanked 0 times
I tried in both htaccess files (root and subdomain) and it did not work.

Mark
__________________
My site is:
www.hotcouponworld.com
markp_2000 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old September 20th, 2007, 10:50 AM   #4 (permalink)
Registered User
Comfy Contributor
 
nathon's Avatar
 
Joined in Sep 2007
Lives in ~root
111 posts
Gave thanks: 1
Thanked 12 times
That was my best shot. I hate mod_rewrite
__________________
I'm proud to say I never have and never will use vista
nathon is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old September 20th, 2007, 3:26 PM   #5 (permalink)
Surpass Fan
Excelling Contributor
 
cowboy's Avatar
 
Joined in Nov 2005
Lives in Colorado
Hosted on DEDI
937 posts
Gave thanks: 2
Thanked 95 times
Quote:
Originally Posted by markp_2000 View Post
I have tried to figure this out, but can't seem to get it.

I'm redirecting my top level (www.hotcouponwworld.com) to www.hotcouponworld.com/forums

I have added a store sub-domain (stores.hotcouponworld.com), but when I got to it I get redirected back to the forums.

Code:
#RewriteBase /
 
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^stores/?$ http://stores.hotcouponworld.com/index.php [R=301,L]
 
RewriteCond %{HTTP_HOST} !^www\.hotcouponworld\.com
RewriteRule (.*) http://www.hotcouponworld.com/forums/$1 [L,R=301]
I know I have done this wrong. Any help is appreciated.

Mark

Your store rule is looking only for hotcouponworld.com/stores and not the subdomain stores.hotcouponworld.com. The second rule will not redirect your domain itself to the forum and is seeing stores. as not www.

Try:

Code:
RewriteCond %{HTTP_HOST} ^stores.*$
RewriteRule .* http://stores.hotcouponworld.com/index.php [R=301,L]
 
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^stores/?$ http://stores.hotcouponworld.com/index.php [R=301,L]
 
RewriteCond %{HTTP_HOST} ^www\.hotcouponworld\.com/?.* [NC,OR]
RewriteCond %{HTTP_HOST} ^hotcouponworld\.com/?.* [NC]
RewriteRule (.*) http://www.hotcouponworld.com/forums$1 [L,R=301]
/forums$1 might need to be /forums/$1
__________________
Where would you be if you were at the highest court in the land (US)?
cowboy is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
This user thanks cowboy for this great post!
markp_2000 (September 22nd, 2007)
Old September 22nd, 2007, 11:02 AM   #6 (permalink)
Registered User
Fresh Surpasser
 
Joined in Aug 2005
12 posts
Gave thanks: 2
Thanked 0 times
Thanks, I got it to work for stores.hotcouponworld.com but not www.hotcouponworld.com/stores

It gives me errors. I don't think this is a rewrite rule though.

Mark
__________________
My site is:
www.hotcouponworld.com
markp_2000 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old September 22nd, 2007, 12:26 PM   #7 (permalink)
Surpass Fan
Excelling Contributor
 
cowboy's Avatar
 
Joined in Nov 2005
Lives in Colorado
Hosted on DEDI
937 posts
Gave thanks: 2
Thanked 95 times
Quote:
Originally Posted by markp_2000 View Post
Thanks, I got it to work for stores.hotcouponworld.com but not www.hotcouponworld.com/stores

It gives me errors. I don't think this is a rewrite rule though.

Mark
See what happens if you change that rule to:
Code:
RewriteRule ^.*stores.*$ http://stores.hotcouponworld.com/index.php [R=301,L]
A .com// is being passed instead of a redirect.


To verify your actual url that you are passing, make a small PHP script and name it like testredirect.php in your public_html directory.

PHP Code:
<?PHP
echo $_GET['test'];
?>
For your first rewrite rule use:

Code:
RewriteCond %{HTTP_HOST} ^.*$ [NC]
RewriteRule (.*) http://www.hotcouponworld.com/testredirect.php?test=$1 [L,R=302]
Change (.*), for everything, to (/whateverregex/?) you want to isolate. Change your condition regex to trap your testdirect as well.

(When using ^.*$ as conditiion, hurry and comment out the condition and rule with # so your whole site is not being redirected for your visitors for long.)

.
__________________
Where would you be if you were at the highest court in the land (US)?
cowboy is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On