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 Link to comment https://forums.phpfreaks.com/topic/131651-solved-mod_rewrite-help/ 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 Link to comment https://forums.phpfreaks.com/topic/131651-solved-mod_rewrite-help/#findComment-683796 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 Link to comment https://forums.phpfreaks.com/topic/131651-solved-mod_rewrite-help/#findComment-683799 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] Link to comment https://forums.phpfreaks.com/topic/131651-solved-mod_rewrite-help/#findComment-683801 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] Link to comment https://forums.phpfreaks.com/topic/131651-solved-mod_rewrite-help/#findComment-683803 Share on other sites More sharing options...
JonnoTheDev Posted November 6, 2008 Share Posted November 6, 2008 Yes. Try your rewritten URL. Link to comment https://forums.phpfreaks.com/topic/131651-solved-mod_rewrite-help/#findComment-683808 Share on other sites More sharing options...
prakash Posted November 6, 2008 Author Share Posted November 6, 2008 thanks it works Link to comment https://forums.phpfreaks.com/topic/131651-solved-mod_rewrite-help/#findComment-683813 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.