|
[18:19] drocd: anyone here handy with regex?
[18:19] fris: yes it does
[18:19] Sands: He's a bot.
[18:19] drocd: or modrewrite
[18:19] fris: drocd: what do you need to do
[18:19] Sands: Total bot.
[18:19] NickSunshine: im feeble at both
[18:19] NickSunshine: what do you want
[18:19] NickSunshine: lol
[18:19] drocd: i want to do www.domain.com/username to bring up profiles... but i dont want it to interfere with like domain.com/images/ and shit like that...or even domain.com/page.html
[18:20] drocd: and im drawing a blank at the moment for the best way to do that
[18:20] zat: erm
[18:20] zat: soo
[18:21] NickSunshine: rewrite rules
[18:21] fris: drocd: make it so www.domain.com/users/sam for example becomes sam.domain.com
[18:22] zat: RewriteRule /users/(.*) /ascript.php?var=$1
[18:22] NickSunshine: just have it exclude the folders you want to preserve
[18:22] drocd: yeah thats not what i want
[18:22] zat: that would throw whatever is after users
[18:22] drocd: i want domain.com/username
[18:22] zat: ok so
[18:22] mortenb: how about RewriteCond %{REQUEST_FILENAME} !-f
[18:22] zat: .. RewriteRule /(.*)
[18:22] mortenb: then it will only rewrite if the file doesn't exist
[18:22] NickSunshine: RewriteCond %{REQUEST_URI} !^/path/to/excluded/files
[18:23] zat: if you put mortenb's thing above mine
[18:23] zat: that would work
[18:23] drocd: ahh mortenb thats what im talkin about
[18:23] NickSunshine: then do the rule under it
[18:23] drocd: mortenb does that include dirs ?
[18:23] mortenb: as far as i know, yes
[18:24] drocd: very good
[18:24] drocd: 
[18:24] drocd: never knew about that
[18:25] zat: we use that statement to block people
[18:25] zat: we set their IP to a file
[18:25] zat: RewriteCond /containerlocal/blocked/IP/%{HTTP:ORIG_CLIENT_IP} -f
[18:25] zat: RewriteCond %{REQUEST_METHOD} !^HEAD$
[18:25] zat: RewriteRule ^(.*)$ - [F,L]
[18:25] zat: pretty damn effective 
[18:25] drocd: i need to learn more about these types of rewrite rules
[18:26] zat: pretty powerfull stufff
[18:26] mortenb: very
[18:26] mortenb: and fun | |
SATURDAY NIGHT SEO SUICIDE!
(or, how to kill your website- almost overnight!)
Tired of that pesky Googlebot crawling around on your sites looking at shit and putting it into their index for all the world to see?
You might be alone. 
If you are using apache web server on a *nix box, and you want it all to stop. . .
Theres something you can about it!
HOW TO PWN GOOGLEBOT WITH .HTACCESS!
Create a file called .htaccess in your root web directory with the following commands inside:
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^Mozilla/5\.0\ \(compatible;\ googlebot/
RewriteRule ^.* - [F,L]
Done and done. 
Ok, a bit of insight into whats happening up there.
RewriteEngine On
This turns on the Apache mod_rewrite module.
RewriteCond %{HTTP_USER_AGENT} ^Mozilla/5\.0\ \(compatible;\ googlebot/
This sets a condition for mod_rewrite that evaluates true when the user agent (browser) of a computer visiting your site matches the evaluation criteria. . .
In this case we are looking to match:
Mozilla/5.0 (compatible; googlebot/2.1; +http://www.google.com/bot.html)
And with a little regular expression love we can trap that pig 
RewriteRule ^.* - [F,L]
This tells mod_rewrite what to do when it is true.
In this case, we're taking any url that is requested and returning a [F] "Forbidden" response.
The [L] directive tells mod_rewrite to stop what it is doing after the command and to see it as the last rule.
Follow this guide, and Google will be off your nuts in no time.
Hope it helps  | |
SIMPLE .HTACCESS REDIRECTION
[19:11] Lucifer:whats a good script i can make and sell?
[19:12] NickSunshine:something that senses the sweet spot in an image and centers the crop around it
[19:13] Lucifer:something simple but needed
[19:14] NickSunshine:dunno
[19:14] NickSunshine:thats what i need more than anything tho
[19:14] NickSunshine:
[19:19] Citizen-X:i got one for you!
[19:19] Lucifer:?
[19:21] Citizen-X:www.analfiend.com - see my links on the right, they are all made as internal links with php, make a script like that but so i can have it appear as simple directory structure, like http://www.analfiend.com/ass-reamed-whores/ etc instead of http://www.analfiend.com/xxx.php?m=assreamedwhores.com
[19:22] Lucifer:thats easily done with htaccess
[19:22] Citizen-X:really, how?
[19:23] Lucifer:its hard to get code right now, don't have access to my main comp
[19:23] Citizen-X:doh
[19:30] NickSunshine:cx
[19:30] NickSunshine:make a folder named friends (or something)
[19:30] NickSunshine:and put .htaccess inside it
[19:31] NickSunshine:
RewriteEngine On
RewriteRule ^(.*)/ ../xxx.php?&m=$1
[19:31] NickSunshine:thats all there is to it
[19:32] Lucifer:there ya go
[19:32] NickSunshine:then you can call it analfiend.com/friends/ass-reamed-whores/
[19:35] Citizen-X: would i have to do that for each link?
[19:35] NickSunshine: not sure i get the question?
[19:36] NickSunshine: youd hafta form each link that way on the front page, yes
[19:36] NickSunshine: but that .htaccess will take any folder below it and try to send it to ../xxx.php | |
|