nvaughan84
nvaughan84

Reputation: 473

How to redirect using regular expressions without changing the URL?

I'm rebuilding a site in wordpress. The existing site has unique profile pages with the URL of the form www.domain.com/b/ch/2lZl.htm

The new system will have unique profile pages of the form www.domain.com/profile/bch2lZL (where bch2lZL is the unique user ID).

What I need to do is get this unique ID and load the page www.domain.com/tracker/public/user/bch2lZL which will do the processing (load in content for this user etc) but don't want the URL to change from www.domain.com/profile/bch2lZL.

I'm hoping this can be achieved with a htaccess redirect where it can load the user can go to the domain www.domain.com/profile/bch2lZL and be presented with the page which is actually at www.domain.com/tracker/public/user/bch2lZL without a change in the URL

Is this possible? And how can I do it?

Cheers in advance

Upvotes: 1

Views: 101

Answers (1)

Wobbles
Wobbles

Reputation: 3135

This can be done with RewriteRule in htaccess

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^/b/ch/(.*).htm$ www.domain.com/profile/$1 [R=301,L]

Upvotes: 1

Related Questions