prakash Posted November 6, 2008 Share Posted November 6, 2008 hi, I need to rewrite http://www.mysite.co.uk/somepage.php?variable=value to http://www.mysite.co.uk/somepage/value what will be the code for .htaccess?? thanks in advance Quote Link to comment Share on other sites More sharing options...
JonnoTheDev Posted November 6, 2008 Share Posted November 6, 2008 If the variable is numeric: RewriteRule ^somepage/([0-9]+)$ /somepage.php?variable=$1 [L] Check the mod rewrite forums for extra info http://www.phpfreaks.com/forums/index.php/board,50.0.html Quote Link to comment Share on other sites More sharing options...
prakash Posted November 6, 2008 Author Share Posted November 6, 2008 actually the content will be like http://www.mysite.co.uk/whois.php?query=msn.com and this need to be rewrite as http://www.mysite.co.uk/whois/msn.com Quote Link to comment Share on other sites More sharing options...
JonnoTheDev Posted November 6, 2008 Share Posted November 6, 2008 RewriteRule ^whois/([a-z0-9\.-]+)$ /whois.php?query=$1 [L] Quote Link to comment Share on other sites More sharing options...
prakash Posted November 6, 2008 Author Share Posted November 6, 2008 is this the correct code? Options All -Indexes Options +FollowSymLinks RewriteEngine on RewriteRule ^whois/([a-z0-9\.-]+)$ /whois.php?query=$1 [L] Quote Link to comment Share on other sites More sharing options...
JonnoTheDev Posted November 6, 2008 Share Posted November 6, 2008 Yes. Try your rewritten URL. Quote Link to comment Share on other sites More sharing options...
prakash Posted November 6, 2008 Author Share Posted November 6, 2008 thanks it works Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.