Hi, i have again a simple problem i can't get solved: RewriteEngine on RewriteBase / RewriteRule ^(.*)$ index2.php?keyword=$1 [L] PHP: //those url's i want to be recognized h*tp://www.domain.com/keyword h*tp://www.domain.com/keyword/ h*tp://www.domain.com/keyword/%&$"$§-random-crap h*tp://www.domain.com/keyword%&$"$§-random-crap Anyone can help me getting all 4 to work without 404? Thanks alot, Brian
I would change ^(.*)$ into ^keyword /index2.php [L,QSE] ^keyword/(.*)$ /index2.php?keyword=$1 [L] ^keyword(.*)$ /index2.php?keyword$1 [L] or something like that. you also didn't have a path in front of your index2.php
Hey much thanks, but it's not fully working.. //This is what i have in my index2.php $_GET['keyword']; PHP: //this should point to index2.php h*tp://www.domain.com/keyword h*tp://www.domain.com/keyword/ h*tp://www.domain.com/keyword/%&$"$§-random-crap h*tp://www.domain.com/keyword%&$"$§-random-crap How can i also detect characters in keyword that are not letters or "_" ? ??
What exactly are you looking for? Maybe my blog post will help if you want to check that out, but I'll try to write something. What is the error? Try commenting out your "RewriteBase /" Regards, Dennis M.
Maybe the best route is not to try to do all of that in the .htaccess but simply send everything after /keyword/ to index2.php and have PHP parse out whatever you try to put behind /keyword/, kinda like how wordpress parses out whatever comes after / A really quick and dirty way to parse (assuming the rewrite sent everything as q=) would be to do something like $queries = explode("&", $_GET['q']); $anitem = explode("=", $queries[2]); (though a foreach loop would be more handy to assigning these to a new associative array).
thanks, seems complicated.. Basically i just want domain.com/keyword to allways be printed out on my index2.php(or index.php) with $_GET['keyword']; PHP: but also domain.com/keyword"§$%&/ etc. not causing error messages.. Any ideas`?