ravi181229 Posted June 12, 2009 Share Posted June 12, 2009 Hi, I have a link <a href="hotel-22-The-Taj-Hotel.html">The Taj Hotel</a> when I click on this, I would like to redirect to myfile.php?hid=24 How do I set this in .htaccess file. Thank you, Ravi Quote Link to comment https://forums.phpfreaks.com/topic/161993-solved-mod_rewrite/ Share on other sites More sharing options...
Ken2k7 Posted June 12, 2009 Share Posted June 12, 2009 WTF? Where did 24 come from? Also, there is a mod_rewrite forum here Quote Link to comment https://forums.phpfreaks.com/topic/161993-solved-mod_rewrite/#findComment-854719 Share on other sites More sharing options...
ravi181229 Posted June 12, 2009 Author Share Posted June 12, 2009 Thanks, sorry, it should be 22. my mistake. I have a link <a href="hotel-22-The-Taj-Hotel.html">The Taj Hotel</a> when I click on this, I would like to redirect to myfile.php?hid=22 I will post in mod_rewrite forum. Quote Link to comment https://forums.phpfreaks.com/topic/161993-solved-mod_rewrite/#findComment-854728 Share on other sites More sharing options...
ravi181229 Posted June 12, 2009 Author Share Posted June 12, 2009 Hi, I have a link <a href="hotel-22-The-Taj-Hotel.html">The Taj Hotel</a> when I click on this, I would like to redirect to myfile.php?hid=22 How do I set this in .htaccess file. Thank you, Ravi Quote Link to comment https://forums.phpfreaks.com/topic/161993-solved-mod_rewrite/#findComment-854754 Share on other sites More sharing options...
MadTechie Posted June 12, 2009 Share Posted June 12, 2009 try RewriteRule ^.+-(\d+?)-.*?\.html$ myfile.php?hid=$1 [NC] Quote Link to comment https://forums.phpfreaks.com/topic/161993-solved-mod_rewrite/#findComment-854767 Share on other sites More sharing options...
ravi181229 Posted June 12, 2009 Author Share Posted June 12, 2009 it's redirecting to hotel-22-The-Taj-Hotel.html and shows 'Now Found'. Quote Link to comment https://forums.phpfreaks.com/topic/161993-solved-mod_rewrite/#findComment-854773 Share on other sites More sharing options...
MadTechie Posted June 12, 2009 Share Posted June 12, 2009 can you post your .htaccess file Quote Link to comment https://forums.phpfreaks.com/topic/161993-solved-mod_rewrite/#findComment-854780 Share on other sites More sharing options...
ravi181229 Posted June 12, 2009 Author Share Posted June 12, 2009 Options +FollowSymLinks RewriteEngine on RewriteBase / RewriteRule ^.+-(\d+?)-.*?\.html$ myfile.php?hid=$1 [NC] Quote Link to comment https://forums.phpfreaks.com/topic/161993-solved-mod_rewrite/#findComment-854786 Share on other sites More sharing options...
MadTechie Posted June 12, 2009 Share Posted June 12, 2009 try this Options +FollowSymLinks RewriteEngine on RewriteBase / RewriteCond %{REQUEST_URI} ^.+-(\d+?)-.*?\.html$ [NC] RewriteRule ^.+-(\d+?)-.*?\.html$ myfile.php?hid=$1 [NC] Quote Link to comment https://forums.phpfreaks.com/topic/161993-solved-mod_rewrite/#findComment-854795 Share on other sites More sharing options...
ravi181229 Posted June 13, 2009 Author Share Posted June 13, 2009 Thanks a lot. Finally it worked with : RewriteCond %{QUERY_STRING} hid=([0-9].*) RewriteRule ^hotel-([0-9]{1,8})-.* /myfile.php?hid=$1 [L] Thank you, Ravi Quote Link to comment https://forums.phpfreaks.com/topic/161993-solved-mod_rewrite/#findComment-854848 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.