View Single Post
  #2 (permalink)  
Old 01-14-2008, 11:25 AM
wige's Avatar
wige wige is online now
Moderator
WebProWorld Moderator
 
Join Date: Jun 2006
Location: United States
Posts: 2,659
wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9
Default Re: .htaccess Help!!

Lets change a few things... first off, there is no need for the first three lines

#RewriteCond %{REQUEST_FILENAME} !\.(jpg|jpeg|gif|png|css|js|pl|txt)$
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*) index.php

The next line is not relevant (its a greedy operator that will always evaluate true, causing the next condition to skip)
#RewriteCond %{HTTP_HOST} .

That leaves us with the two lines that will actually do what you want, redirecting from www.whatever to just whatever
RewriteCond %{HTTP_HOST} !^theticketlodge\.com
RewriteRule (.*) http://theticketlodge.com/$1 [R=301,L]

Next, you just need to create the entry for your error documents. Supposing your error documents are in a folder called /errordocs/notfound.php:

ErrorDocument 404 /errordocs/notfound.php
ErrorDocument 403 /errordocs/notfound.php

Set the first line of your notfound.php script to be:
header("HTTP/1.0 404 Not Found", true, 404);

This will cause all errors to show up as "file not found" errors. If you restrict access to a folder for testing in the future for example, instead of the site serving a 403 forbidden message to unauthorized visitors, the user will see a file not found message.
__________________
The best way to learn anything, is to question everything.
Reply With Quote