mjurmann Posted March 26, 2008 Share Posted March 26, 2008 Hello, I am extremely confused by something. I'm trying to rewrite URLs using mod_rewrite, and it is working..to an extent. The following RewriteRule is an example of the problem I'm experiencing: RewriteRule ^products/datasheets/$ http://www.url.com/datasheets.php When I click on the link, url.com/products/datasheets/ it goes to the page, url.com/datasheets.php (as I have defined in the above rule). However, the URL field at the top of the browser displays url.com/datasheets.php, rather than the rewritten, directory-style structure of url.com/products/datasheets/. I am absolutely clueless as to why this is happening? I would appreciate any help. Quote Link to comment https://forums.phpfreaks.com/topic/97974-mod_rewrite-working-to-an-extent/ Share on other sites More sharing options...
wildteen88 Posted March 26, 2008 Share Posted March 26, 2008 because you are using an absolute http address Apache will redirect the user to http://www.url.com/datasheets.php. To stop the redirect just use a relative url: RewriteRule ^products/datasheets/$ /datasheets.php Quote Link to comment https://forums.phpfreaks.com/topic/97974-mod_rewrite-working-to-an-extent/#findComment-501285 Share on other sites More sharing options...
mjurmann Posted March 26, 2008 Author Share Posted March 26, 2008 Wow, you are awesome. Thank you so much. Seriously, you just saved the day! THANK YOU Quote Link to comment https://forums.phpfreaks.com/topic/97974-mod_rewrite-working-to-an-extent/#findComment-501290 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.