[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 264
  • Last Modified:

Rewrite URLs in htaccess file

Hello Experts,
My htaccess file looks like this. currently i am rewriting my urls from

mysite.com/store/merchant.mvc?Screen=PROD&Product_Code=easter_egg_hunt&Category_Code=Easter

to mysite.com/store/easter_egg_hunt-p-easter.html

here is the code i am using my htaccess file

RewriteRule ^store/([A-Za-z0-9_-]+)-p-([^.]+)\.html$ /store/merchant.mvc?Screen=PROD&Product_Code=$1&Category_Code=$2


I want to change this to display like this
mysite.com/store/easter_egg_hunt/easter.html

how can i rewrite my htaccess file to achieve this.

Thanks and appreciate it
0
niceoneishere
Asked:
niceoneishere
1 Solution
 
Chad SmithSoftware EngineerCommented:
RewriteRule ^store/([A-Za-z0-9_-]+)/([^.]+)\.html$ /store/merchant.mvc?Screen=PROD&Product_Code=$1&Category_Code=$2
0
 
marchentCommented:
RewriteRule ^store/([A-Za-z0-9_-]+)-p-([^.]+)\.html$ /store/$1/$2.html
0
 
marchentCommented:
sorry... got wrong... i thought its regex...
0
 
arober11Commented:
Or:

RewriteRule ^store/([^/]+)/([^.]+)\.html$      /store/merchant.mvc?Screen=PROD&Product_Code=$1&Category_Code=$2 [L]
0
 
niceoneishereAuthor Commented:
Thanks
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now