Eric
Eric

Reputation: 429

Using htaccess to rewrite a URL

I want to change the URL of two specific pages in my application:

app.mysite.com/thanks/type/b/ changes to app.mysite.com/thanks/buyer/

and

app.mysite.com/thanks/type/s/ changes to app.mysite.com/d/thanks/supplier/

What would be the appropriate rewrite statement?

Upvotes: 0

Views: 97

Answers (2)

Paul
Paul

Reputation: 141917

RewriteRule ^thanks/type/b/?$ thanks/buyer/
RewriteRule ^thanks/type/s/?$ d/thanks/supplier/

Upvotes: 1

Jason McCreary
Jason McCreary

Reputation: 73031

The follow should do what you want and allows an optional trailing slash, (i.e. /thanks/buyer or /thanks/buyer/)

RewriteEngine On
RewriteBase /

RewriteRule ^thanks/buyer/?$ /thanks/type/b/
RewriteRule ^d/thanks/supplier/?$ /thanks/type/s/

Upvotes: 0

Related Questions