Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-14-2009, 08:16 PM   PM User | #1
student101
Regular Coder

 
student101's Avatar
 
Join Date: Nov 2007
Posts: 610
Thanks: 80
Thanked 13 Times in 13 Posts
student101 is on a distinguished road
Question htaccess and folders? "/" or "\"

Code:
# 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:
Code:
RewriteCond %{REQUEST_URI} .comments/page.php\.php*
Or this:
Code:
RewriteCond %{REQUEST_URI} .comments\page.php\.php*
Or this:
Code:
RewriteCond %{REQUEST_URI} .http://www/example.com/comments/page.php\.php*
Or this:
Code:
RewriteCond %{REQUEST_URI} ./var/htdocs/web/comments/page.php\.php*
Edit: I have searched and found nothing that answers my question!
Any help would be great.
Cheers
__________________
Thanks for your support!
Update MySQL with checkboxes | Tell A Friend | Delete MySQL with checkboxes

Give thanks & resolve when done :thumbsup:

Last edited by student101; 03-15-2009 at 08:50 AM..
student101 is offline   Reply With Quote
Old 03-15-2009, 08:51 AM   PM User | #2
student101
Regular Coder

 
student101's Avatar
 
Join Date: Nov 2007
Posts: 610
Thanks: 80
Thanked 13 Times in 13 Posts
student101 is on a distinguished road
I really need help understanding what this does and if I am correct at all???
Code:
 
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
__________________
Thanks for your support!
Update MySQL with checkboxes | Tell A Friend | Delete MySQL with checkboxes

Give thanks & resolve when done :thumbsup:

Last edited by student101; 03-16-2009 at 09:26 AM.. Reason: More info...
student101 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:25 PM.


Advertisement
Log in to turn off these ads.