Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3
  1. #1
    CPW
    CPW is offline
    Member
    Join Date
    Sep 2006
    Posts
    53
    Member #
    13935
    I have a hosting account at Hostmonster with multiple domains on it. The main domain is compeek.net, and one of the addon domains, for example, is pizzaandfries.com (which, by the way, is my private forum, so that's why you can't get to it). However, the way Hostmonster sets things up, each domain gets a folder that is a subfolder of public_html, so going to www.compeek.net/pizzaandfries shows the same thing as www.pizzaandfries.com. I used mod_rewrite to automatically redirect to www.pizzaandfries.com if you visit the subfolder, but I want to do more than this. I want to make the subfolder completely invisible by serving a 404 error if you visit www.compeek.net/pizzaandfries instead of going to www.pizzaandfries.com. Is this possible?

    Right now I have code like this to do the redirection:
    Code:
    RewriteCond %{HTTP_HOST} ^www.compeek.net$
    RewriteRule ^(.*)$ http://www.sliceofacorn.com/$1 [R=301,L]
    I've tried searching around, but I can't seem to find a way to "fake" a 404 instead of redirecting. Is this possible? Thanks!

  2.  

  3. #2
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    I'm guessing you could change 301 to 404. 301 is one of the HTTP response codes.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  4. #3
    CPW
    CPW is offline
    Member
    Join Date
    Sep 2006
    Posts
    53
    Member #
    13935
    Thanks! It was the obvious solution, but it never occurred to me because I haven't seen 404 in any mod_rewrite examples, so I guess I just assumed you can't do that. I now have this code, which works perfectly:

    Code:
    RewriteCond %{HTTP_HOST} ^www.compeek.net$
    RewriteRule ^(.*)$ $1 [R=404,L]


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 07:17 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com