Web Hosting Talk







View Full Version : htaccess problem


danyboy2010
02-04-2007, 01:05 PM
I have to deal with a htaccess file and have some problems

The code i posted at botton makes url friendly www.site.com/category/hosts in main.php?category=host

How i can make it no to apply the rule on some specific folders like forum , articles where i have to add separate scripts

Thanks

RewriteEngine on

Options +FollowSymLinks

RewriteCond %{REQUEST_URI} !(main\.php)
RewriteCond %{QUERY_STRING} !(direct)
RewriteRule (.*) main.php?page=$1 [PT]

RewriteCond %{QUERY_STRING} (direct)
RewriteRule (.*) $1 [PT]

hsbsitez
02-04-2007, 10:17 PM
http://forum.modrewrite.com/viewtopic.php?t=1446&sid=4f50ec3d26c91efa57186dc94e6f5cc9
read the part
^ has two purposes, when used inside of [ ] it desingates 'not'. (EG [^0-9] would match any character that is not 0 to 9 and [^abc] would match any character that is not a lowercase a, b, or c.) When used in mod-rewrite it also designates the begining of a 'line'.

It is very important to understand and remember [dog] does not match the word 'dog', it matches any individual lowercase letter d, o, or g anywhere in the comparison. In the same way, [^dog] does not exclude the word 'dog' from matching, it excludes the lowercase letters d, o, or g from matching individually.

To match a 'word' or a group of characters in order, you need to use () so (dog) would match the word dog, and not d, o, or g as a single character.

danyboy2010
02-05-2007, 02:31 PM
Thanks for the tutorial is great.. it put some light on htaccess rewrite rules scarry things :stickout:

RewriteRule ^forum(/.*)?$ - [L]