Jump to content

Close, solving the mystery of .htaccess


ckrudelux

Recommended Posts

Found a online .htaccess tester: http://martinmelin.se/rewrite-rule-tester/So I thougth I should try my luck with this tool, I'm not any good at this but I try to SMASH the keys on the keybord so it looks cool for everyone else looking.Doing this I got a light bulb over my head after looking at the match output from my some what guessing key pattern.Conclusion: for each RewriteRule I did the next RewriteRule inherit the previous rewritten URL so I came up with this no guessing pattern and it works like a charm, until I tested it on local test server..So instead of geting ?page=start from the input /q/page/start I got ?page=start/page/startadding this to my index.php file:

<?php	echo "<pre>";	print_r($_GET);	echo "</pre>";		echo $_SERVER['SCRIPT_FILENAME'];	echo "?";	echo $_SERVER['QUERY_STRING'];?>

Options +FollowSymLinksRewriteEngine OnRewriteBase /RewriteRule ^([Q-q])/([^/]*)/([^/]*)/(.*)$ $1/$2=$3&$4 [N]

So this outputs whats expected: q/page/start

Options +FollowSymLinksRewriteEngine OnRewriteBase /RewriteRule ^([Q-q])/([^/]*)/([^/]*)/(.*)$ $1/$2=$3&$4 [N]RewriteRule ^([Q-q])/([^/]*)/(.*)$ $1/$2=$3

This does also print out the right stuff: q/page=startNext one will not change the output cause it has nothing to removeLast one should change q/ to ? but it seems like it takes q/page/start and removes the q/ and add's to the end... :) This works:Copy this into the textarea on what page above and typing "q/key/value/key/value" see the pattern?Yes Q stands for query.

Options +FollowSymLinksRewriteEngine OnRewriteBase /RewriteRule ^([Q-q])/([^/]*)/([^/]*)/(.*)$ $1/$2=$3&$4 [N]RewriteRule ^([Q-q])/([^/]*)/(.*)$ $1/$2=$3RewriteRule (.*)&$ $1RewriteRule ^[Q-q]/(.*)$ ?$1

So what is wrong?.. or is my light bulb broken? :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...