Jump to content

URL Rewrite Issue


never_rain

Recommended Posts

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

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.