I am interested to mod rewrite nichewatch urls. Here is its pattern http://www.nichewatch.com/?nicheword=ambatchdotcom+seocontest&cos=mos where cos=mos shows that it has been searched already. And i want static url as http://www.nichewatch.com/ambatchdotcom-seocontest.html Could you help me in doing this?
Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^([^.]+)-([^.]+)\.html$ index.php?nicheword=$1+$2&cos=mos [L] RewriteRule ^([^.]+)\.html$ index.php?nicheword=$1&cos=mos [L] Yes, this is mod_rewrite!!
Wow great Thank You Nintendo it works as i thought But now there is only one minor issue that is keywords search could be of any number of words like seo (1 word) ambatchdotcom seocontest (2 words) outdoor wood furnace (3 words) and it could be of 4,5..... and so on. Currently it works with 1 word and 2 words only it doesn't work with 2+ words.
RewriteRule ^([^.]+)\-([^.]+)\-([^.]+)\-([^.]+)\-([^.]+)\.html$ index.php?nicheword=$1+$2+$3+$4+$5&cos=mos [L] RewriteRule ^([^.]+)\-([^.]+)\-([^.]+)\-([^.]+)\.html$ index.php?nicheword=$1+$2+$3+$4&cos=mos [L] RewriteRule ^([^.]+)\-([^.]+)\-([^.]+)\.html$ index.php?nicheword=$1+$2+$3&cos=mos [L] RewriteRule ^([^.]+)\-([^.]+)\.html$ index.php?nicheword=$1+$2&cos=mos [L] RewriteRule ^([^.]+)\.html$ index.php?nicheword=$1&cos=mos [L]
haha Seeing it would solve 99% possible problem because only most foolish person would search keyword with 5+ words. But if there would be any then Errors would start and he would butt his head because it will run into loop where first 5 words would be considered 1 and last would be another 1 and rule of 2 would execute in case of 6 words searched. Sorry currently i am messing with english
With mod-rewrite, you don't redirect to any URL, unlike the 301. Visitors will have no idea what the original URL is. It just makes fake URLs work.