never_rain Posted May 5, 2008 Share Posted May 5, 2008 I am new into URL rewrite. I have a task to re write a URL which looks like this. www.domain.com/index.php?pg=detail&catId=1&catTitle=2 [nc] After rewrite, it should look like this www.domain.com/aboutus.html (about us is the cat title so it will change with every argument) However, I have achieved the following. www.domain.com/detail/8/aboutus.html I have used the following line of code to get this result. RewriteRule ^detail/(.*)/(.*)$ /sitewonders/index.php?pg=detail&catId=$1&catTitle=$2 [nc] What my requirement is that I dont want to show detail and 8 whereas detail is the page where my codes are stored and 8 is the product category.I have not clue how to get hold of this. Please give me any clue or help to achieve this target. Thanks Quote Link to comment Share on other sites More sharing options...
Michan Posted May 5, 2008 Share Posted May 5, 2008 Try this: RewriteRule ^aboutus.html$ /sitewonders/index.php?pg=detail&catId=1&catTitle=2 Quote Link to comment Share on other sites More sharing options...
never_rain Posted May 5, 2008 Author Share Posted May 5, 2008 Try this: RewriteRule ^aboutus.html$ /sitewonders/index.php?pg=detail&catId=1&catTitle=2 aboutus.html is an example. As I said, aboutus is fetched by using catTitle so if the value of catTitle is profile, so it should show profile.html and if the value in catTitle is services then it should show services.html. Quote Link to comment Share on other sites More sharing options...
Michan Posted May 5, 2008 Share Posted May 5, 2008 Alright, then give this a try: RewriteRule ^([^/]+)(/([^/]+))?.html$ /sitewonders/index.php?pg=detail&catId=%3&catTitle=%1 Good luck! Quote Link to comment Share on other sites More sharing options...
never_rain Posted May 5, 2008 Author Share Posted May 5, 2008 Alright, then give this a try: RewriteRule ^([^/]+)(/([^/]+))?.html$ /sitewonders/index.php?pg=detail&catId=%3&catTitle=%1 Good luck! Thanks for your help. I need to show you the menu file where I have put the a href code. I am not sure how to call your provided parameters. If you can just have a look at it. <a href="<?=$webPath?>detail/<?=$viewcat['pk_id']?>/<?=str_replace(' ', '_', $viewcat['cat_Title'])?>.html" class="b"> $webpath is the URL of my site. detail you already know but using your provided code, what should I pass there.. I have no clue about it. Thanks again for your help. Quote Link to comment 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.