Jump to content

Evil Glint

Members
  • Posts

    33
  • Joined

  • Last visited

    Never

Everything posted by Evil Glint

  1. I made a mistake: If you add this code to the "user sites" virtual host, it ruins the whole redirect: ErrorDocument 404 /404.php Put the code in the .htaccess file (if it is enabled) for better results.
  2. A while back, I asked about changing the default website location for Mac OS X users from "http://site.com/~user/" to "http://user.site.com/". From "http://site.com/~user/" to "http://user.site.com/" I now have my answer, but the topic is too old to bump. If anyone else is looking for this information: In httpd.conf, make sure these lines are commented out, or do not exist: LoadModule userdir_module libexec/httpd/mod_userdir.so AddModule mod_userdir.c Make sure these lines exist, and are not commented out: LoadModule vhost_alias_module libexec/httpd/mod_vhost_alias.so AddModule mod_vhost_alias.c UseCanonicalName On Add a virtual host container: # User Sites <VirtualHost *:80> UseCanonicalName Off VirtualDocumentRoot /Users/%-2/Sites </VirtualHost> When using virtual hosts, the main website becomes inaccessible. To remedy this, we create a second virtual host, that mimics the main web server. # Main Website: <VirtualHost *:80> DocumentRoot /Library/WebServer/Documents ServerName domain.tk ServerAlias 10.0.0.2 localhost 127.0.0.1 </VirtualHost> Replace: "domain.tk" with the domain of your site "10.0.0.2" with your LAN IP address "127.0.0.1" with your internal IP address (usually "127.0.0.1") Note: The user sites virtual host MUST be at the TOP of your list of virtual hosts, or it WILL NOT WORK! All domain / sub-domain names that are not specifically assigned will be sent to the first virtual host, so if the user sites virtual host is not the first on the list, IT WILL NEVER BE USED. Also, if you don't have wild-card DNS, you will need to make a record of each user's sub-domain with your DNS provider. If you want to avoid sending 404 pages to people who access your server from URLs that you don't anticipate (such as "http:// www .domain.tk/" if you don't use "www.", or http:// domain.tk/ if you do use "www.", or other extra sub-domains, if you have wild-card DNS), add this line outside the virtual hosts: ErrorDocument 404 http://domain.tk/ Change "domain.tk" to your preferred domain. To prevent this from redirecting 404 errors on your main / user sites, override it by adding this to both of your virtual host containers (and any other virtual hosts you may have): ErrorDocument 404 /404.php Change to match the location of your 404 page. Man, that was long winded. Time to breath. Some of that info was discovered by trial and error, but I must give credit to http://web-magician.blogspot.com/2007/07/dynamic-virtual-host-with-apache.html for the final piece of the puzzle. It has a far more understandable guide to dynamic virtual hosts than the Apache manual.
  3. Apparently, I can't read. I went on a wild Google goose chase, and only got anywhere after rereading your post. Great idea! After experimenting with clearing cookies and whatnot, it seems very secure. FINALY! I never can find a simple set of instructions for the Apache httpd.conf file. Google gives me anything I want to know about HTML/CSS/PHP/JavaScript/any-other-internet-coding-language, bet not anything helpful about the httpd.conf file. Thank you very much, PFMaBiSmAd and thorpe!
  4. No problems at the moment. Comcast (my isp) said if there would be a problem if I used too much bandwidth, so, being as paranoid as I am, I'm trying to set up preventive measures. So how do I stop those people? Also, I noticed a typo in the code in my last post, but was unable to edit my post. It should read:Options +FollowSymlinks # no hot-linking RewriteEngine On RewriteCond %{REQUEST_URI} !hotlink.gif$ RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://()?example\.tk/ [NC] RewriteCond %{HTTP_REFERER} !^http://(www\.)?example\.tk/ [NC] RewriteCond %{HTTP_REFERER} !^http://(brotherssite\.)?example\.tk/ [NC] RewriteCond %{HTTP_REFERER} !^http://(sisterssite\.)?example\.tk/ [NC] RewriteRule .*\.(gif|jpg|png)$ http://example.tk/hotlink.gif [R,NC]
  5. I'm new to this, so I didn't realize .htaccess and httpd.conf used the same language. My other question was do I need to make an exeption for each subdomain and the main domain? Such as: Options +FollowSymlinks # no hot-linking RewriteEngine On RewriteCond %{REQUEST_URI} !nohotlinking.gif$ RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://()?example\.tk/ [NC] RewriteCond %{HTTP_REFERER} !^http://(www\.)?example\.tk/ [NC] RewriteCond %{HTTP_REFERER} !^http://(brotherssite\.)?example\.tk/ [NC] RewriteCond %{HTTP_REFERER} !^http://(sisterssite\.)?example\.tk/ [NC] RewriteRule .*\.(gif|jpg|png)$ http://example.tk/hotlink.gif [R,NC] Also, I don't know what line five is used for, or if I even need it: RewriteCond %{HTTP_REFERER} !^$
  6. I found a similar topic, but it uses .htaccess. I would prefer to keep that disabled, and use http.conf instead. http://www.phpfreaks.com/forums/mod_rewrite/need-help-with-stubborn-hotlinking-prevention-rules/msg1131912/#msg1131912 Also, I don't know if it makes a difference, but my server has four sites I want protected. For the sake of not spamming about my site, I'll call them: example.tk www,example.tk (yes, unlike usual, www points to an entirely different site on my server, with different content) brotherssite.example.tk sisterssite.example.tk Any ideas? Blacklotus' final .htaccess code: Options +FollowSymlinks # no hot-linking RewriteEngine On RewriteCond %{REQUEST_URI} !nohotlinking.gif$ RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(www\.)?vortexaviation\.ca/ [NC] RewriteCond %{HTTP_REFERER} !google\. [NC] RewriteCond %{HTTP_REFERER} !search\?q=cache [NC] RewriteRule .*\.(gif|jpg|png)$ http://www.vortexaviation.ca/images/nohotlinking.gif [R,NC]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.