RahulVicky001 Posted February 26, 2014 Share Posted February 26, 2014 I am using WAMP and my url is localhost/hotel/hotels.php?id=21Using rewrite rule as follow,Options +FollowSymLinksRewriteEngine onRewriteRule hotels/id/(.*)/ hotels.php?id=$1RewriteRule hotels/id/(.*) hotels.php?id=$1But nothing happens..My mod_rewrite is on and also changes done in httpd.conf file.Please give me a suggesstion to handle the issue? Quote Link to comment https://forums.phpfreaks.com/topic/286535-cant-redirect-my-url-with-htaccess/ Share on other sites More sharing options...
Ch0cu3r Posted February 26, 2014 Share Posted February 26, 2014 This is not how mod_rewrite works. It does not automatically change the urls for you. You need to change your existing urls to the new url format that matches the rewriteRule you setup in the .htaccess. eg change your links to echo '<a href="/hotels/id/'.$hotel_id.'>View Hotel</a>'; When you click the link you'll go to locahost/hotels/id/21. Here mod_rewrite will match that url with the rewriterule in the htaccess. It'll now pass the number 21 to hotels.php?id=21. Quote Link to comment https://forums.phpfreaks.com/topic/286535-cant-redirect-my-url-with-htaccess/#findComment-1470732 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.