...

View Full Version : htaccess and folders? "/" or "\"



student101
03-14-2009, 09:16 PM
# block comment spam by denying access to no-referrer requests
RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} .page\.php*
RewriteCond %{HTTP_REFERER} !.*example.com.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule ^(.*)$ ^http://the-site-where-you-want-to-send-spammers.com/$ [R=301,L]
I am new to .htaccess and have to ask…
Q1: Can I use this for any page that is posting data?
Q2: If Q1 is YES, my page is one folder deep, ie:comments/page.php
Do I do this:

RewriteCond %{REQUEST_URI} .comments/page.php\.php*
Or this:

RewriteCond %{REQUEST_URI} .comments\page.php\.php*
Or this:

RewriteCond %{REQUEST_URI} .http://www/example.com/comments/page.php\.php*
Or this:

RewriteCond %{REQUEST_URI} ./var/htdocs/web/comments/page.php\.php*
I have searched and found nothing that answers my question!Any help would be great.
Cheers

student101
03-15-2009, 09:51 AM
I really need help understanding what this does and if I am correct at all???


RewriteEngine On # The RewriteEngine directive enables or disables the runtime rewriting engine.
RewriteCond %{REQUEST_METHOD} POST # The RewriteCond directive defines a rule condition.
RewriteCond %{REQUEST_URI} .folder/pagename\.php* # Contains the value of the uri field of request? This part I don't get at all. is "/" or "\" or even "./" or ".\" (without quotes)
RewriteCond %{HTTP_REFERER} !.*example.com.* [OR] # Check the REFERER
RewriteCond %{HTTP_USER_AGENT} ^$ # Rewrite the Homepage, according to the User-Agent
RewriteRule (.*) http://%{REMOTE_ADDR}/$ [R=301,L] # Send the user back to their page they came from? This part I don't get either.


Cheers



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum