mod_rewrite and bad url's

Fix it!!

mod_rewrite and bad url's

Postby tcjn » Sun Jul 08, 2007 9:34 am

Hi Everyone.

When someone add to my url "bleah" for example : http://mysite.com/index.php?id=1&id="bleah" a wont referer him to my index page how i can do this in mod rewrite?
tcjn
 
Posts: 1
Joined: Sun Jul 08, 2007 9:26 am

Postby richardk » Mon Jul 09, 2007 11:56 am

So you want to redirect if there are two or more id variables?

In a .htaccess file in your document root
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{QUERY_STRING} ^(.*&)?id=(.*&)?id= [NC]
RewriteRule ^index\.php$ /index.php? [R=301,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Security with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 1 guest

cron