Solved

Rewrite URLs in htaccess file

Posted on 2010-08-30
5
253 Views
Last Modified: 2012-05-10
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
Comment
Question by:niceoneishere
5 Comments
 
LVL 10

Accepted Solution

by:
Chad Smith earned 500 total points
ID: 33562985
RewriteRule ^store/([A-Za-z0-9_-]+)/([^.]+)\.html$ /store/merchant.mvc?Screen=PROD&Product_Code=$1&Category_Code=$2
0
 
LVL 13

Expert Comment

by:marchent
ID: 33563173
RewriteRule ^store/([A-Za-z0-9_-]+)-p-([^.]+)\.html$ /store/$1/$2.html
0
 
LVL 13

Expert Comment

by:marchent
ID: 33563190
sorry... got wrong... i thought its regex...
0
 
LVL 26

Expert Comment

by:arober11
ID: 33578238
Or:

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

Author Closing Comment

by:niceoneishere
ID: 33720168
Thanks
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now