stig1 Posted March 8, 2009 Share Posted March 8, 2009 I would like to create a rewrite rule to convert the following url into something else. domainname.com/browse.php?catalog=1 into the following domainname.com/tape.html Any ideas? I'm stuck. Quote Link to comment https://forums.phpfreaks.com/topic/148436-simple-question/ Share on other sites More sharing options...
corbin Posted March 8, 2009 Share Posted March 8, 2009 You will not be able to directly do it with IDs like that. You will have to rewrite something like domainname.com/tape.html to domainname.com/page.php?catalog=tape. Mod_rewrite cannot (well, should not) map names to IDs. Anyway, you could do this your self if you googled for a second, but: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/]+)\.html$ /browse.php?catalog_name=$1 Quote Link to comment https://forums.phpfreaks.com/topic/148436-simple-question/#findComment-779310 Share on other sites More sharing options...
stig1 Posted March 8, 2009 Author Share Posted March 8, 2009 so if my url is www.domainname.com.au/browse.php?cat=10 and id like to rewrite the url to www.domainname.com.au/tape_product.php can this be done with mod_rewrite? as i would like to make my url's more search engine friendly. Quote Link to comment https://forums.phpfreaks.com/topic/148436-simple-question/#findComment-779326 Share on other sites More sharing options...
trq Posted March 8, 2009 Share Posted March 8, 2009 can this be done with mod_rewrite? You need to read Corbin's reply again. Quote Link to comment https://forums.phpfreaks.com/topic/148436-simple-question/#findComment-779335 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.